Question 1
Consider the following 2D array declaration in C:
unsigned int x[4][3] = {{10, 20, 30}, {40, 50, 60}, {70, 80, 90}, {100, 110, 120}};
Assuming the base address of x is 2000 in decimal and an unsigned integer occupies 4 bytes of memory, what are the values printed by 'printf("%u, %u, %u", x + 3, *(x + 3), *(x + 2) + 3);'?
Detailed Solution
'x + 3' advances by 3 rows of 3 integers each (3 * 3 * 4 = 36 bytes), evaluating to address 2036. '*(x + 3)' decays into a pointer to the first element of row 3, which is also memory address 2036. '*(x + 2) + 3' gives address of row 2 plus 3 elements (2000 + 2*3*4 + 3*4 = 2036).