C StructuresLesson 35Free preview
C Structures
This lesson is part of C · All levels
Summary
Structure is a custom data type that combines several different variables of the type into one named container. Each part in it is called a member or field, and is accessed via a point sign such as p.nama after storing data on the struct-type variable. Structure is suitable for representing relational data such as student data (name, nim, value) in a single unit. With struct, interconnected data becomes more streamlined and easier to operate.
Key points
- Struct is declared with the keyword struct followed by the type name and the list of members
- Member is accessed by the point operator (.) of the struct variable
- Members may have different types within a single struct
- A function can accept struct as an argument, either by copying or by pointer
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.