Midterm Study Guide
This is simply a guide of topics that I consider important for the midterm. I don’t promise to ask you about them all, or about any of these in particular; but I may very well ask you about any of these, as well as anything we discussed in class, in the discussion section, or that is in the programs and handouts.
- Fundamentals
- How to compile a C program and save the results as something other than a.out
- How to log in to the CSIF
- Basic Linux commands: ls(1), ps(1), rm(1), gcc(1), apropos(1), man(1), vi(1)/vim(1)
- Structure of a C program
- main, return, exit
- Idea of an exit status code
- Basics of C
- Variable names
- Keywords
- Data types (int, float, double, char)
- Data type modifiers (signed, unsigned, long, short
- How true and false are represented
- Expressions
- Arithmetic operators; precedence, associativity
- Increment (++) and decrement (-{-})
- Logical operators
- Relational operators and Boolean values
- Type coercion (char to int, int to float, float to double)
- Input and output
- File pointers, especially stdin, stdout, stderr
- Opening and closing files
- getchar(), getc(), scanf(), fgets()
- putchar(), putc(), printf(), fputs()
- Statements
- Assignments, including += and other assignment operators
- for loop
- while, do … while loops
- if, if ... else, if ... elif ... else, nested ifs
- switch statement
- continue, break
- Functions
- Declaring and defining functions
- Returning a value; return statement
- Parameters and arguments
- Scope (local vs. global, etc.)
- Static variables in function
- Functions
- Defining them
- Parameter lists and how they work
- Returning a value; return statement
- Parameters and arguments
- Scope (local vs. global, etc.)
- Static variables in function
- Pointers
- What it is
- Declaring and using pointer variables
- Dereferencing (*) and taking the address of (&)
- Use in parameter lists
- Array of pointers
- Arrays
- Declaring an array
- Referencing an element of the array
- Relationship between arrays and pointers
- Arrays as function parameters and arguments
- Strings
- What is a string
- Array of strings
- String functions: strcpy, strcat, strcmp, n versions, strlen, strtok
- String to number conversion, number to string conversion: the sscanf, sprintf, snprintf
- Robust programming
- Checking input for validity
- Buffer overflows