how come when I use the dereference operator on this expression it actually prints out a memory address not the actual value of b+2
since b is a 2 * 2 matrix its 2 rows are at b[0] and b[1], so b+2 is not a valid memory address. In general for pointer representations of 2D arrays think about the memory allocation first in terms of the rows and then for each row in terms of it's columns, something along the line of the following program: