1,426 views
2 votes
2 votes

What is the output of the following ?

int main()

{

int arr[2][3][2]={1,2,3,4,5,6,7,8,9,10,11,12};

printf("%d%d", a[1]-a[0], a[1][0]-a[0][0]);

return 0;

}

1 Answer

Best answer
9 votes
9 votes

Ans will be 3, 6 (no matter what you take integer size - because that efferct will be normalized) I have taken 2 B.

Just refer following diagram, a[1]-a[0] = 106-100/size of int = 6/2 = 3

a[1][0]-a[0][0] = 212 - 200/size of int = 12/2 = 6

selected by

Related questions

1 votes
1 votes
2 answers
3
0 votes
0 votes
1 answer
4
Gurdeep Saini asked Feb 1, 2019
613 views
is it dangling pointer ?int main(void) { int* p;printf("%d",*p); return 0;} https://ideone.com/IN77el