Structure is a user-defined datatype in C language which allows us to combine data of different types together by using struct() function.
Structure is somewhat similar to an Array, but an array holds data of similar type only. in other hand, it can store data of any type, which is practically more useful in c language.
‘struct’ keyword is used to create a structure.
struct structure_name { data-type member-1; data-type member-2; data-type member-3; data-type member-4; };
struct student { int roll_no; char name[30]; int phone_number; }; main() { struct student p1, p2, p3; }
Here, p1, p2 and p3 are the variables of the structure 'student'.
First Student roll_no : 1 name : Brown phone_number : 123443 Second Student roll_no : 2 name : Sam phone_number : 1234567822 Third Student roll_no : 3 name : Addy phone_number : 1234567844