0 votes 0 votes give the complete solution with explanation int main() { int arr [2] [2] [2] = {10,2,3,4,5,6,7,8}; int *p, *q; p = &arr[1] [1] [1]; q = (int*) arr; printf("%d ,%d \n",*p ,*q); return 0; } Programming in C programming-in-c pointers array + – shivam sharma 5 asked Aug 28, 2018 • edited Aug 28, 2018 by Shaik Masthan shivam sharma 5 563 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply arvin commented Aug 28, 2018 reply Follow Share 8 and 10 0 votes 0 votes Shaik Masthan commented Aug 28, 2018 reply Follow Share @shivam sharma 5 don't miss use the tags.... you can include your requirement either in your question or comment 0 votes 0 votes shivam sharma 5 commented Aug 28, 2018 reply Follow Share please provide the stepwise solution so that it can be easy to understand 0 votes 0 votes lakshaysaini2013 commented Sep 2, 2018 reply Follow Share a[1][1][1] so first a[1] land you to the matrix {5,6,7,8} now you need to choose a[1][1] of this matrix so it will be 8 and and when we assign the array name to a pointer we give the base address to it so *q will give 10 hence result will be 8 10 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes Ans will be *p = 8 *q = 10 for clear idea, your array can be seen as arr[0] arr[1] $\begin{bmatrix} 10 & 2\\ 3& 4 \end{bmatrix}$ $\begin{bmatrix} 5 & 6\\ 7& 8 \end{bmatrix}$ Ravi Raja answered Aug 28, 2018 Ravi Raja comment Share Follow See 1 comment See all 1 1 comment reply MiNiPanda commented Aug 28, 2018 reply Follow Share p = &arr[1] [1] [1] p holds the address of the element at 1th column of 1th row of 1th 2-D array. 1th 2-D matrix is $\begin{pmatrix} 5 &6 \\ 7 &8 \end{pmatrix}$ Then 1th row is [7 8] Element at 1th colum is 8. So p holds the address of 8 and *p gives value at that address which is 8. q holds the base address of the 3-D array type casted to (int *) as q is a pointer to an integer type. The element at the base is 10(i.e. the first element). So *q gives 10. 0 votes 0 votes Please log in or register to add a comment.