there is a significant difference between the storage of 1-D arrays and 2-D arrays in memory… the name of a 1-D array variable (called a reference for the array) acts as a pointer, which points to the memory address where the first element of the array is stored. But this is not the case in 2-D array. The reference of a 2-D array points to an array of pointers, and each pointer in this array “points” to a 1-D array, forming an array of arrays , called a 2-D array. Here is an image to help you visualize:
now, in your code, a is the pointer which points to the first element in the array of pointers, as shown in the image.
*a represents the pointer to which ‘a’ points, i.e. the first element in the array of pointers.
*(a+1) refers to the 2nd element in the array of pointers. This pointer points to the first element of the second row of the 2-D array, as shown in the image. Hence,
*(a+1)) will give you the value of a
], i.e. 1st element of 2nd row. Hence, the assignement operation should be like:
*(a+1))=3 (or any other value you might want)