Verified Answers
A tour of computer systems summary slide - ANSWERS - Architectural details
matter
-Bus widths
-Numeric properties
-Performance details
- C and POSIX are just one possible system
- All systems have those details
- Software correctness can be critically important
an array can be initialized all at once at declaration, how? - ANSWERS An array
can be initialized all at once at declaration.
int array [10] = { 0 , 3 , 5 , 0 , 0 , 1 , 0 , 0 , 2 , 0 };
This is called a static initializer.
Static initializers can be used only at declaration.
int array [3];
array = { 1 , 3 , 5 }; /* syntax error */
are all arguments pass-by-value? - ANSWERS yes, they are copies of whatever is
passed to them
Are non-zero values true or false? - ANSWERS true
, k&r 2.7
Arrays - ANSWERS - C arrays are a series of contiguous memory locations
- declared with [ ] the size is between the [ ]
Because heap allocations have no obvious size... - ANSWERS out-of-bounds
access is easy, and the compiler will not catch this
bitwise 0 is true or false? - ANSWERS false
bitwise non 0 is true or false? - ANSWERS true
boolean false and false results are exactly? - ANSWERS 0
boolean true and true results are exactly? - ANSWERS 1
Bus - ANSWERS has a width which is literally the number of wires it has
C a typed language? - ANSWERS - C is a typed language
- every variable has a type and is declared
- every value assigned to a variable must match that type
C strings - ANSWERS are just arrays, not associated with a length (you have to
count characters to know how long they are)