• retagged by
637 views
0 0 votes
What is the output of this code in c?

int main(){
static int a[][2][3]={0,1,2,3,4,5,6,7,8,9,10,11,12};
int i=-1;
int d;
d=a[i++][++i][++i]; printf("%d",d); return 0;
}

 

how did 2 come as the answer? please explain,thanks.

Please log in or register to answer this question.

Position:
Show:

Related questions

1 1 vote
2 2 answers
420
420 views
Shubham Sharma 2 asked Sep 9, 2025
420 views
#include<stdio.h void main() { int arr[]={1, 2, 3, 4, 5}; int *p=arr; printf("%d", *p++); printf("%d", *(p+1)); }Find the output of the above code?$1,2$$1,3$$2,3$$1,4$
0 0 votes
1 1 answer
370
370 views
Shubham Sharma 2 asked Sep 9, 2025
370 views
Consider following C program :#include<stdio.h int main() { int x[]={2,4,6,8,10}; int a, b=0, * y = x+4; for(a = 0; a<5; a++) { b=b+(*y -a) - *(y -a); } printf("%d\n", b)...
0 0 votes
1 1 answer
284
284 views
Shubham Sharma 2 asked Sep 9, 2025
284 views
What will be the output of the following $\text{C}$ code?#include<stdio.h void main() { int arr[5]={10,20,30,40,50}; int *p = (int*) (&arr+1); printf("\%d\%d", *(arr + 1)...