0
Please explain the output!
5 odpowiedzi
+ 6
#define PRINTF "%s, Bazinga ! \n"
printf(PRINTF,PRINTF);
Above statement is same as
printf("%s, Bazinga ! \n", "%s, Bazinga ! \n");
Format specifier is used twice i.e %s
First statement will processed like this,
"%s Bazinga !
" ---> Note: ending double quote is on new line
Now, %s will be replaced by the string "%s, Bazinga ! \n"
So final output is like :
"%s, Bazinga !
,Bazinga !
"
Why %s is not replaced again?
Well that's because now it is part of string.
+ 4
nAutAxH AhmAd
Thank you so much !
Very explanatory answer. Helped me understand. And thanks for the double quote mention too :)
+ 3
~ swim ~
Thanks a ton !
Thanks for the brief overview of theory that I highly needed . You explain it so well. I really appreciate the example case as well. Best part!