From the course: C: Data Structures, Pointers, and File Systems

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Building a structure

Building a structure - C Tutorial

From the course: C: Data Structures, Pointers, and File Systems

Start my 1-month free trial

Building a structure

- [Instructor] A structure is a container for multiple variable types. The variables can be different data types, the same data types, or mixed and matched in various quantities. These variable types are somehow related, or referenced as a single unit, like a record in a database. The keyword struct defines the structure. It's followed by the structure's name and then the set of braces or curly brackets. Within the braces are lists of variable declarations. These become the members of the structure. To use the structure, you must create a variable of the structure type. Structure members are accessed by using the structure variable name, a dot, and then the member name as defined in the structure. So birthday is a structure variable and month is the name of a member of that structure. The members work like any individual variable in your code. They can be assigned values, sent to a function, used in an equation, and so on. In this code the pixel structure is declared at line five. It…

Contents