Quiz 5: Study Guide
Wednesday, May 02, 2012An Incomplete List of Potential Topics:
- New for this quiz
- Separate Compilation
- Why do we use separate compilation?
- What do we need to do to access functions from one .c file that are defined in another .c files?
- What does the compiler do during separate compilation?
- What does the linker do during separate compilation?
- What sort of errors do we get when we compile incorrectly? (ie. forget one of the .c files)
- Pointers
- What sort of data types can we create pointers to?
- What is the syntax to declare a pointer?
- What is the syntax to pass a pointer to a function?
- What is the syntax to pass a string to a function?
- What is the star unary (*) operator called? What does it do?
- What is the ampersand unary (&) operator called? What does it do?
- What sort of data types do we normally use the star operator on?
- What sort of data types do we normally use the ampersand operator on?
- Where is the data that a pointer points to stored?
- What do pointers allow us to do?
- How do we printout the value a pointer is pointing to?
- How do we use scanf to input a value to the memory a pointer is pointing to?
- String Functions
- strlen()
- strcat()
- strcpy()
- strncpy()
- strstr()
- How are they used?
- How would we implement them?
- What header file do we use to include them?
- Separate Compilation
- Topics from previous quizzes
- Arrays
- How to define an array
- Invalid defintions of arrays
- Accessing array elements
- Using loops to access arrays
- How to prevent accessing invalid array elements
- How memory for arrays are stored
- Strings
- Relationship of strings and arrays
- How does C mark the end of a string?
- How does the computer store the NULL character?
- Input and output for strings
- How to tell scanf the maximum characters to input
- What happens if you don't limit the number of characters to input?
- Program Design
- Top-down design, what is it?
- How does top-down design help us create programs?
- Common programming errors covered last class
- Wrong function signatures
- Return when function has signature "void function(...)"
- Use of scanf overwriting input arguments
- Shadowing input arguments with variables
- Using printf when asked to return value
- Loops
- do...while
- while
- for
- What can go in test expressions?
- Use of break or return to break out of loops
- Nested loops
- Libraries
- Math library include (math.h) adding library to compilation (-lm)
- C Standard library includes (stdlib.h, stdio.h)
- Linker combines compiled source code and libraries into executable
- GCC is front end, acts as both the compiler and linker
- Functions
- Create functions
- Arguments
- Return types
- Calling functions
- Use of void (as return type or arguments)
- Conditional expressions
- if
- if...else
- if...else if...
- Relational operators (<, >, <=, >=, ==, !=)
- Logical operators (||, &&)
- Values for true (non-zero) and false (zero)
- Switch
- When can it be used vs if-else-if...
- Limitations of use
- Case statement fall-through
- Default
- Input/Output
- Character input (how to avoid problem with extra-return)
- Printf and scanf syntax for integer, double, and char
- Arrays