0

Can somebody please explain the following C snippet?

https://code.sololearn.com/cKDcYYo16N84/?ref=app

31st Oct 2020, 5:52 AM
Devi Prasad D
Devi Prasad D - avatar
3 Respuestas
+ 6
printf("%d\n",printf("%d",printf("%d",a))); When you see a nested function call like this, begin from the inner most call working your way outwards to the outer most call. * printf function on success returns the total number of characters written (http://www.cplusplus.com/reference/cstdio/printf/). * Inner call printf("%d", a); // a = 43 This prints '43' and returns 2 (number of characters used to print '43') * Middle call printf("%d", 2); // 2 is return value from inner most call above This prints '2' and returns 1 (number of characters used to print '2') * Outer call printf("%d\n", 1); // 1 is return value from middle call above This prints '1' and returns 1 (number of characters used to print '1') Hth, cmiiw
31st Oct 2020, 6:14 AM
Ipang
+ 2
++༒«ᵛ ⁱ ⁿ ᵃ ʸ ᵃ ᵏ»༒++ I was guessing it came from a challenge bro 😂
31st Oct 2020, 9:20 AM
Ipang
+ 1
No this one's from a book called coding for interviews, the answer is already given but with no proper explanation.
31st Oct 2020, 11:45 AM
Devi Prasad D
Devi Prasad D - avatar