edited by
637 views
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;

}
edited by

1 Answer

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}$

Related questions

796
views
1 answers
0 votes
aditi19 asked Sep 13, 2018
796 views
what is wrong with this code? It shows segmentation fault#include<stdio.h>#include<stdlib.h>void main(){ int i,j,count=1; int **a=(int**)malloc(3*sizeof(int*)); for(i=0; i<3; ... ("%d ",a[i][j]); } printf("\n"); }}
1.3k
views
1 answers
4 votes
kd..... asked Apr 25, 2018
1,285 views
Why is it illegal initialization?#include<stdio.h> #include<string.h> main() { char *s[]={"Lakshya","cquest","brainq","cidol"}; char **ss[]={(s+3),(s+2),(s+1),(s+0)}; char ... *++sss); printf("%s",*--*++sss+3); printf("%s",sss[-1][-1]+1); }
14
views
0 answers
–1 votes
shivamSK asked 6 days ago
14 views
​​​​assume pf meaning is printf statement.A 4222B 4234C 4234D 4233
1.5k
views
2 answers
1 votes
Ahsanul Hoque asked Feb 17, 2019
1,475 views
Tell me the difference :&(arr+1) and &arr+1