Discussion
printf ( "%d" , printf ( "tim" ) ):
Answer: B
Correct answer: outputs tim3
The inner printf is evaluated first as the argument to the outer one. It writes tim and returns the number of characters written, which is 3. The outer printf then prints that return value.
So the output is tim followed by 3. The point of the exercise is that printf returns a value at all - the character count - which is easy to forget because it is almost always discarded.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development