+ 2

int n=printf("0"); printf("%d",n);

What will be the output

19th Aug 2019, 12:03 PM
Khushi Puri
Khushi Puri - avatar
6 Respostas
+ 9
printf function returns the number of characters it prints on the console. int n = printf("0"); First 0 will be printed, then it will return the number of characters it printed which in this case 1. So n is equal to 1. On next line, printf("%d", n) ; well print 1 which is the value of n. So 01 is the output.
19th Aug 2019, 12:14 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 4
01 Btw, you can run this and check by yourself. And please specify the relevant tags.
19th Aug 2019, 12:10 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 4
Khushi Puri, nAutAxH AhmAd means, why you gave Java tag as you asked a C language question
19th Aug 2019, 12:43 PM
Farhan
Farhan - avatar
+ 3
Please explain
19th Aug 2019, 12:11 PM
Khushi Puri
Khushi Puri - avatar
+ 3
Thanks
19th Aug 2019, 12:18 PM
Khushi Puri
Khushi Puri - avatar
+ 3
Farhan Sorry for the mistake
19th Aug 2019, 12:44 PM
Khushi Puri
Khushi Puri - avatar