Structures and Arrays

Strutures are user defiened data types, whereas arrays are derived data types. While an array is a collection of nalogous elements elements, a structure assembles dissimilar elements under one roof. thus both arrays and structures allow several values to be treated together as a single data object.
int a[]={10,20,30,40,50}; // array are elements of the same type (int)
student stud1={2, "Rahul",12, 67.00, 'A'}; // structure elements are of different types
Arrays of structures
Using arrays of structures is similar to using arrays of anything else. When structures are present within an array you have an array of structures. To declare an array of structures, LEARN MORE>>

No comments: