1/11
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Arrays
store multiple variables of the same type
int anArray[7]
int: data type
anArray: name/ identifier
[7]: size
elements
value stored in a specific space in the array
for loops
help store values into each space in the array
uses int value index or whatever you want to call it
anArray[3] = 1;
anArray[3]: expression used to refer to one element
=1: the value of that element
if you reach outside the bounds of the array
there won’t be a compiler error
might lead to junk
Macro
can be used to set size
can be set then changed using varible in the array
#define SIZE 100
int array[SIZE]
use for loop with index to store into array[index]
variable
user decides size
scalar
single value varibles
composite
multiple values
Behavior
data isn’t displayed but stays within the size you have set for the data
contiguous
memory addresses are sequential