+ 1
Why is the output 2?
#include<stdio.h> int main() { int a[3] ={2,1,0}; printf("%d",a[a[2]]); }
7 Antworten
+ 4
a[2]=0,and a[0]=2
+ 2
Divide the question into simpler terms and go step by step
+ 2
See printf("%d",a[a[2]]);
Here a[2] will be calculated first because it is present inside . After calculation answer=0(a[2]). Now the value of a[0] =2
0
Sorry
Can you elaborate ?
0
Thanks mate
Got it!!
0
Hridoy Banik My pleasure