+ 1
Why this code shows warning? please clear my doubt
We know that in C program,the array name itself act as a pointer to first element of its array. Then what about in multidimensional array, Is here also array name act as a pointer to first element? Please clarify my doubt https://code.sololearn.com/cMD7Rdrc7hww/?ref=app
1 Respuesta
+ 1
Consider a multidimensional array as array of arrays.
so here the name of array points to first element of the 2-D array which in this case is an array of size 2. And according to the declaration ( int *p ), the pointer should point to an integer variable, hence the warning.
A probable fix is to declare "p" as a pointer to array of type int and then perform initialization. This will obviously lead to change in how you acess them.
https://code.sololearn.com/cX4EOsjz0GZW/?ref=app