The C language allows us to create custom data types. The structure is a custom data type which c combines different data types . The structure is a custom data type which combine different data …
Read More »Structures
Structure Initialization
a structure variable can be initialization as any other data type. Main() { static struct { int weight; float height; } } student{560,080,75}; This assign the value 60 to student weight and 180.75 student height. …
Read More »Comparison of structure variables
Two variables of the same structure type can be compared the same way as ordinary variables. operation meaning person1=person2*assign perosn2 to person1 person1== person2*compare all name of person1 and person2 and return1
Read More »Arrays of structures
The most common use of structures is in arrays of structures. To declare an array of structures, first the structure is defined then an array variable of that structure is declared. E.g.: struct class student …
Read More »Arrays with in structures
Single as multidimensional arrays of type int as float can be defined as structure members. Example: struct marks { int number; float subject[3]; } student [2]; Here the member subject contains three elements, subject[0], subject[1] …
Read More »Structures with in structures
Structures within a structure means nesting of structures. Example: struct salary { char name [20]; char department [10]; int basic-pay; int dearness-allowance; int huse_rent_allowance; int city_allowance; } employee; This structure defines name, department, basic pay …
Read More »Passing structure to function
There are three methods by which the values of structure can be transferred from one function to another: 1. The first method is to pass each member of the structure as an actual argument of …
Read More »