2D array vs array of arrays

A 2 dimensional array is by definition an array of arrays. What Dave was saying is that in that context, there are different semantics between the definition of a 2D array like this: this: or this:

Is the sizeof(some pointer) always equal to four?

he guarantee you get is that sizeof(char) == 1. There are no other guarantees, including no guarantee that sizeof(int *) == sizeof(double *). In practice, pointers will be size 2 on a 16-bit system (if you can find one), 4 on a 32-bit system, and 8 on a 64-bit system, but there’s nothing to be gained in … Read more