본문 바로가기

Structs and typedef: . vs ->

English

Grouping related data

  • A struct groups several values into one thing. A point has an x and a y; a rectangle has a width and a height.
  • Each value inside is called a member (or field). They can have different types.
  • Structs let you pass one tidy thing around instead of many loose variables.

struct Point p holds x = 2 and y = 5; p.x and ptr->x both give 2

교재 자료

로그인 또는 계정 만들기

IGCSE, A-Level & AP