Week 4: Memory Maps / String Functions / Simple I/O Flashcards
A char takes how many bytes
1 byte
An int takes how many bytes
4 bytes
A float takes how many bytes?
4 bytes
Do different VARIABLES have to be contiguous?
NO
What is in the memory location when a variable is declared?
Whatever was there before
How many statements does the computer see in the following:
int height = 8;
Two, one for declaration and another for initialization
What is a “scalar” variable?
A variable capable of of holding a single data item
What is an “aggregate” variable?
A variable capable of holding a collection of values
arrays and structures
What are the two kinds of aggregate variables in C?
Arrays and structures
What is an array initializer?
The contents of an array enclosed in curly brackets
{1,2,3,4,0,0,0}
What does this do?
int a[10];
Declares an array of type int with 10 elements
What does this do?
int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
Declares an array of type int with 10 elements AND what the elements are
What does this do?
int a[10] = {1, 2, 3, 4, 5, 6};
/* initial value of a is {1, 2, 3, 4, 5, 6, 0, 0, 0, 0} */
The remaining values become 0s
What does this do?
int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
If an initializer is present, the length of the array may be omitted:
In the case of no length given for an array, but an initializer is, what does the compiler do?
The compiler uses the length of the initializer
to determine how long the array is.