Welcome Guest | Sign in | Register
Preprocessor Directives - Discussion Page For Q.10597 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Preprocessor Directives > Questions and Answers

Exercise:

Section 1

Q: What is the output of following C code?

#define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
}
A. 100 B. 200
C. Compiler Error D. null

Answer and Explanation

Answer:100

Explanation:
Preprocessor executes as a separate pass before the execution of the compiler. So textual replacement of clrscr() to 100 occurs. The input program to compiler looks like this :
main()
{
100;
printf("%d\n",100);
}
Note:
100; is an executable statement but with no action. So it doesn't give any problem

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.