Here we review some of the major concepts covered in this class to date. This is a grounding lecture to ensure all have sufficient competency to complete simple programs covering all course material.

Reference

Variable Types

Recall the standard common variable types used in C. This is not an exhaustive list, but contains many of the most common datatypes used in C programming.

char       Typically a single octet(one byte). This is an integer type.
int          The most natural size of integer for the machine.
float       A single-precision floating point value.
double   A double-precision floating point value.
void        Represents the absence of type.

Conditionals

if(condition) {
  EXECUTE CODE
} else if(condition) {
  EXECUTE CODE
} else {
  EXECUTE CODE
}

Loops

For loops and while loops are the two most common loop styles in C. Recall for a loop - it begins at a value in the initialization section. It is checked for looping conditions in control, and is the initialized variable is modified in update.

for (initialization; control; update) {
  //loop body
}

this is equivalent to

//initialization
while(control) {
  //loop body
  //update
}

Arrays

int balance[] = {1000, 2, 3, 7, 10};

          :
Address:  :     Value at that address:
        |----|
  0x5100|1000|  first values in array
        |----|
  0x5104|   2|  second value of array
        |----|
  0x5108|   3|  third value of array
        |----|
  0x5112|   7|  fourth value of array
        |----|
  0x5116|  10|  fifth value of array
        |----|
          :
          :
balance[4] = 50;
          :
Address:  :     Value at that address:
        |----|
  0x5100|1000|  first values in array
        |----|
  0x5104|   2|  second value of array
        |----|
  0x5108|   3|  third value of array
        |----|
  0x5112|   7|  fourth value of array
        |----|
  0x5116|  50|  fifth value of array
        |----|
          :
          :