Discussion
What is the output of this program?
#include <stdio.h>
#define clrscr() 17
int main()
{
clrscr();
printf("%d",clrscr());
return 0;
}
Answer: C
Correct answer: 17
clrscr() is a function-like macro expanding to the constant 17. The first call becomes the statement 17;, which computes a value and discards it - legal, if pointless. The printf then expands to printf("%d", 17) and prints 17.
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