+ 1
What is the output of this code? Why?
char str[] = "%d %c", arr[] = "Sololearn"; printf(str, 0[arr], 2[arr + 3]); https://code.sololearn.com/cuQCT8ENQIzb/?ref=app
4 Answers
+ 13
Here 0[arr] means first element of array and it is S . And here %d is given so we have to calculate ASCII value of S and it is 83.
2[arr + 3] = 2[0 + 3] = 2[3] = 6
mean 6th element of array and it is e.
So the answer is 83 e.
+ 11
Array start with 0 so arr =0
2[arr +3]
=2[0 + 3]
=2[3]
=6
So, the 6th element of an arr is e.
I hope you understand.
+ 1
Rohit Gupta 2[3]=6 i can't understandđ„đ„
+ 1
Rohit Gupta
thanks
i got it