Download presentation
Presentation is loading. Please wait.
1
Structs And Arrays
2
Array vs Struct Aggregated structures Array : homogenous (same type)
Struct : heterogeneous (different type) array struct Arithmetic No Assignment Yes Input/output No (except C-strings) Comparison Parameter passing By reference only By value or by reference Function returning a value
3
Array of Students Can make an array of struct type:
4
Accessing Element Accessing an element gives us a student:
OK to use as student NOT OK : Use as name/grade/etc…
5
Accessing Element Use [i].member to access element fields:
6
Contained Arrays Struct can contain an array:
7
Contained Arrays .array[index] to access:
8
Array Of Students With Array Of Scores
30 records Each record Name Birthdate 10 scores
9
Array Of Students With Array Of Scores
Struct: Main:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.