+ 2

Please find output along with explain me this c language code.

Char str[]="%d %c", arr[]=Sololearn; printf(str, 0[arr], 2[arr+3]);

29th Jun 2019, 5:56 PM
Gaurav Rawat
Gaurav Rawat - avatar
5 Réponses
+ 5
0[arr] is also arr[0] which is S converting this to integer is 83 2[arr+3] is also arr[2+3]-->arr[5] which is e, since the specifier is %c it output e the ans is 83 e
29th Jun 2019, 8:20 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
the str already have what needs to be there, it has the format to print each values
30th Jun 2019, 7:04 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
you can do printf(str); that is considered a string, "%d %s" is a string then replace it with what is inside printf we will have printf("%d %s") is that not the same
30th Jun 2019, 10:41 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
But in printf function doesnt have any format specifier. It has str which have. I dont know the way of using this printf function and it doesnt have double quot.
30th Jun 2019, 5:28 AM
Gaurav Rawat
Gaurav Rawat - avatar
+ 2
But without double quotation ("") how format specifier works??
30th Jun 2019, 10:31 AM
Gaurav Rawat
Gaurav Rawat - avatar