Array Quiz Flashcards
Simple data type
variables of these types can store only one value at a time
Structured data type
a data type in which each data item is a collection of other data items
Array
a collection of a fixed number of components, all of the same data type
One-dimensional array
components are arranged in a list form
declaring one-dimensional arrays
datatype arrayName[intExp]
intExp
any constant expression that evaluates to a positive integer
Index
position of some data in an array
[ ]
array subscripting operator. Always starts at 0
basic operations
Initializing, Inputting data, Outputting data stored in an array, Finding the largest and/or smallest element
does c++ guard against out of bounds indexs?
nope
Aggregate operation
any operation that manipulates the entire array as a single unit. Not allowed in c++
Are arrays passed by reference only?
yes, don’t use & operator. Const in the formal decorator to detach
base address
the address (memory location) of the first array component, if it’s a one-dimensional array, its base address is the address of list[0]
Sequential search
Searching a list for a given item, starting from the first array element and moving one by one
Selection sort
rearrange the list by selecting an element and moving it to its proper position
auto
auto declare a variable
null terminal
\0’
A’ vs “A”
character vs string
can a char array be initialized like: char name[] = “John”?
yes
what does cin.get(str, m+1) do?
stores the next m characters into str, but the newline character is not stored in str
what is a c_str?
converts std string to a c-syle string as it’s less abstracted
how do you declaire 2d arrays?
arrayName [indexSize] [indexSize]
row processing
Process a single row at a time
column processing
Process a single column at a time