CSCI 235 — C: the low level look

The C pointer operators

Why does the following expression depend on the type of p?
    (unsigned long)(void *)(p+1) - (unsigned long)(void *)p

More facts about arrays

C and memory

C presents a low-level address-based view of memory.

// static allocation
double sPressure[500][500][100] ;

// dynamic allocation
double (*dPressure)[500][100] ;
dPressure = malloc(500*500*100*sizeof(double)) ;

// Java style
double ***jPressure ;
// requires a loop to initialize

A look at the pointer questions from old exams

You must draw it to understand it!

The goto