Campus interview zone
Would you like to react to this message? Create an account in a few clicks or log in to continue.

What is the output of following-9

Go down

What is the output of following-9 Empty What is the output of following-9

Post  Admin Sun Jan 31, 2010 7:53 am

24.#define clrscr() 100
main()
{
clrscr();
printf("%d\n",clrscr());
}
Answer:
100
Explanation:
Preprocessor executes as a seperate 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
25. main()
{
printf("%p",main);
}
Answer:
Some address will be printed.

Explanation:
is also a function. So the address of function main will be printed. %p in printf specifies that the argument is an address. They are printed as hexadecimal numbers.

27) main()
{
clrscr();
}
clrscr();
Answer:
No output/error
Explanation:
The first clrscr() occurs inside a function. So it becomes a function call. In the second clrscr(); is a function declaration (because it is not inside any function).

Admin
Admin

Posts : 71
Join date : 2010-01-21

http://campus-interview.co.cc

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum