+ 2

Having a hard time trying to understand this, can you figure it out??

What is the output of this code? And why? char str[] = "%d %c", arr[] = "Sololearn"; printf(str, 0[arr], 2[arr + 3]);

30th Aug 2020, 1:30 PM
Gujjula Pradeep Reddy
Gujjula Pradeep Reddy - avatar
1 Answer
+ 6
the first char array str has the formatting in it, and the second arr is having a string "Sololearn when the printf() is executed 0[arr] is equal to *(arr+0) which is 'S' and as the str[] has %d so it returns ascii value of 'S' which is 83 2[arr +3] is equal to *(arr+5) which takes the char value 'e' So it returns output as : 83 e
30th Aug 2020, 1:39 PM
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ 
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ  - avatar