Discussion
What is the output of the following 'C' program?
main
{
extern int i;
i = 20;
print("%d",size of (i));
}
Answer: D
Correct answer: Error
The fragment will not compile, and for several reasons at once. main is written without parentheses, so it is not a function definition; print is not a standard function, the output function being printf; and size of is written with a space, so the operator sizeof is not recognised.
Any one of these is fatal. The extern int i; declaration is itself legal, but with no definition anywhere the link would fail even if the syntax were repaired.
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