Skip to content · ⁨الانتقال إلى المحتوى⁩

Structs and typedef: . vs -> · ⁨الهياكل و typedef: . مقابل ->⁩

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.

A Point struct with x and y; reach a field with . on the struct, or -> through a pointer

Handout · ⁨ورقة عمل⁩

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP