Qualifiers

Short, long

short - 4 bytes long - 8 bytes unsigned const

Primitives

char, int, double, float

Define

can do #define to replace text within code with other text

  • can use it for types
  • common pitfalls for PEMDAS arithmetic if replacing math

When is the source code modified? Preprocess, compilation, or what?

Pointer

Pointers hold an address We use * to dereference and & to get reference e.g. * to get value within and & to get address of

declaration of pointer

int *a

usage

printing a returns pointer value (the address in the pointer) printing *a returns value in the pointer address “

Sizeof

In relation to char A char is 1 byte So a short is 4 bytes, long is 8 bytes and they return those on sizeof call

QUIZ: Pointer incremenetation

Pointer data type matters Incrementing a pointer increases the pointer value by the sizeof the pointer data type

QUIZ: array name is a const pointer

int a[]

a is a const so cannot modify!!! sizeof(a) returns number of elements times sizeof(int) or whatever data type

arrays can also be accessed via *(a + i)