0
what is the output of this code?
printf(%d %d,printf("ayush"),printf("shalya"))
3 Answers
+ 12
(E-R-R-O-R đ€Ș in your case without terminating semi colon, proper quotes and so)
EXPLANATION :
So that's a nested printf in C.
The compiler treats this
printf("%d %d", printf("ayush"), printf("shalya")) ;
like
printf(("%d %d", (printf("ayush"), (printf("shalya") )))) ;
( I hope the Parenthesis are well paired)
then the compiler starts executing from the innermost printf function that is printf("shalya") in our case and then printf("ayush") and so.
Hence outputting shalya ayush.
Now its the turn of outermost part[(("%d %d", (printf("ayush"), (printf("shalya") )))] to be executed.
(On success the printf returns the total number of characters. On failure, a negative number is returned.)
hence returning the length of shalya and ayush to %d.
Hence we 5 and 6 in our case.
(I hope I'm correct)
Pro Ash
https://code.sololearn.com/c0mR26RU4981/?ref=app
+ 15
Post ur programming related queries not quizzes
If you want to play quizzes , u can post this in ur post feed
https://www.sololearn.com/discuss/1316935/?ref=app
+ 7
Does that even exist? đ