*(a+1)=3; is wrong.
are you trying to set the a to 3 ?
when you use a *(a+1) it will translate to (address of a + 4) which holds another address since its a double array. so you cannot assign an integer to an pointer without deference so this statement could be changed to either ((a+1)) or a.
if the array would have been a the this statement is valid *(a+1) will translate to *(address of a + 4) which can be assigned to say any int value.
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:
Actually in this case if u write * ( a + 1 ) then it means u are at second ROW but Column not specified.
that’s why u are getting error.
So simply write * ( * ( a + 1 ) ) = 3 then 3 will be override by 3
and if u write * ( * ( a + 1 ) + 1 ) = 10 then 4 will be override by 10
this is the difference between a 1-D array, and a 2-D array… ‘a’ points to an ARRAY OF POINTERS, hence *a represents another pointer, which is the first element of the array of pointers. this pointer (‘*a’), in turn, points to the first element of the first row… (look at the figure CLOSELY)