









































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Structures, Unions, Structure definition, Variables of type structure, Pointers to Structure, Array of Structure, Initializing Structures, Accessing structure members are the key points of this lecture.
Typology: Slides
1 / 49
This page cannot be seen from the preview
Don't miss anything!










































Structure
Structure definition struct Student { char name [ 60 ] ; char address [ 100 ] ; Data of the structure double gpa ; } ; Structure name
Keyword
Structure struct address { char streetAddress [ 100 ] ; char city [ 30 ] ; char country [ 30 ] ; }
Structure struct Student { char name [ 60 ] ; address add ; double gpa ; } s1 , s2 , s3 ;
Structures
Array of Structure
Student s [ 100 ] ; Student *sPtr ; Structures
Student s1 , s2 ; s1 = s2 ; Structures
Example 2 struct Student { char name [ 64 ] ; char course [ 128 ] ; int age ; int year ; } ;
s1.age = 20 ; s1.name = “Abbas Ali ” ; //Wrong strcpy ( s1.name , “Abbas Ali ” ) ;
Assignment of structures Student s1 , s2 ; s2 = s1 ;
Passing Structures to Functions