bscodinglab

Structure

 In C language, a structure is a user-defined data type that allows the programmer to group related data items of different data types into a single unit. A structure can be used to represent a record, such as a student record, employee record, or customer record. Each data item in a structure is called a member or a field, and it can be of any data type, including integer, float, double, char, pointer, or even another structure.

The syntax for defining a structure in C language is:-

struct structure_name

            {

                        data_type member1;

                        data_type member2;

                        …

                        data_type memberN;

            };

Here, structure_name is the name of the structure, and member1, member2, …, and memberN are the members of the structure, each with a unique name and data type.