1/7
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
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 integers
Indexed 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 1st
Arrays
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]);