435 views
0 votes
0 votes

what is the output of printf("%d",printf("gate19")?

3 Answers

3 votes
3 votes
Printf(“gate19”)  output is gate19

printf(“%d”,printf(“gate19”)) output is 6

printf returns an integer with number of characters it printed

so final answer is gate19 6
1 votes
1 votes

It is to be noted that the printf() returns the number of characters that it prints

 

Thus, by executing the inner printf(), we have got

 gate19(because 'g', 'a',  't',  'e,1,9 (6) characters),

 Now, when the outer printf() is executed, 6 is printed.

Answer is -gate19 6

0 votes
0 votes
it will print "gate19 6" ......first printf("gate19"); (inside the printf )---------------> it will print  gate19

                                       second printf(" ")---------------->count number of the alphabet (because %d is mention here, it will change in %f ,%c ,%d.....etc) in gate19 i.e 6 so it will print

     "gate19 6"

No related questions found