Like any other data type, a structure variable can be initialized at compile time. An example of compile time initialization of the student structure is shown below: 1 2 3 4 5 6 7 8 9 struct student { char name; char rollno; int age; char grade; }; struct student student1 = {“teja”,”10A1”,26,’A’}; struct student student2 = {“raju”,”10A2”,24,’B’}; In the above example: teja, 10A1, 26 and A are assigned to student1’s name, rollno, age and grade. Whereas raju, 10A2, 24, B are assigned to student2’s name, rollno, age and grade. Note: Partial initialization of a structure variable is supported. For
The post What is structure initialization and array of structures appeared first on Coding Security.
What is structure initialization and array of structures
read more
Tidak ada komentar:
Posting Komentar