Chapter 7 Flashcards
what is an array used for?
storing multiple values of the same type
how can you access an element of an array?
by using an index
what is the syntax of an array?
element type arrayName [SIZE]
the size of an array must be a ______
constant
array indicies are are ____ based
zero
what us the syntax for an element in an array?
arrayName [index]
what is the syntax for a array intializer?
elementType arrayName [arraySize] = {value0, value1,…valuek};
when using an array initializer can you declare and initialize in more than one statement?
no. splitting declaration and and initialization causes a syntax error
can you omit the array size when initializing an array?
yes. c++ will figure out how many elements there are in the array
if you wan to initialize an array, do you have to initialize every number in the array?
no, but all the other number will be set to zero
since the size of the array is known it is common to use a ____ loop
for
if you have to arrays, list and mylist, can you copy mylist to list like such?
list = my list
no just must copy the individual elements from one array to the other