Save
Arrays Part 1
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Sophia Jessa
Visit profile
Cards (13)
Arrays
are structures of
related data items.
Static
Entity
- same size throughout the program
Dynamic
data structures
Arrays
are group of
consecutive memory locations
Format: arrayname [position number]
what do you need to specify?
-array
name
-position
number
what is the first element at position?
0
in declaring arrays, you need to specify:
name
type
of array
number
of elements
if not enough
initializers
, rightmost elements become
0
if too many elements,
syntax error
if size is omitted,
initializers
determine it
The
array
is passed – as an
array
of
unspecified
size (
int array
[]) OR – as a
pointer
(int
*array
)
●
Changes
to the array within the function
affect
the
“original”
array