1/7
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Use
storing and managing bigger blocks of data
provide a simple way of storing multiple instances ‘a sequence’ of the same data type
Declaring
int aListOfInts[5]; //array of 5 integersIndexed from…
0
Initialiser
can initialise only part of the array
starting from 0
int aListOfInts[5] = {1, 2, 3, 4, 5};
aListOfInts[0] = 5; //overwriting the 1stArrays
named contiguous data blocks in memory
don’t know how many elements are initialised
Arrays won’t Grow if…
you access memory before or after the allocated space
Array Bounds
C compiler won’t protect you
need to track these yourself and code defensively
Printing a Value in an Array
printf("Element 3 is %d\n", aListOfInts[2]);