January 2015
Intermediate to advanced
96 pages
1h 20m
English
CHAPTER 13
![]()
Struct
A struct or structure is a user-defined type used for grouping a collection of related variables under a single name. To define a structure you use the struct keyword, followed by an optional identifier and a code block containing variable declarations. The definition of this new type is ended with a semicolon.
struct point { int x, y;};
Unlike arrays, structs allow data items of different kinds to be combined. Structs may contain variables, pointers, arrays, or other user-defined types. In contrast to C++, structs in C may not contain functions.
Struct Objects
To declare a variable of a struct type, the struct keyword is followed ...
Read now
Unlock full access