What is the output of following-9
Page 1 of 1
What is the output of following-9
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).
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).
Similar topics
» What is the output of following-4
» What is the output of following-5
» What is the output of following-6
» What is the output of following-7
» What is the output of following-8
» What is the output of following-5
» What is the output of following-6
» What is the output of following-7
» What is the output of following-8
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|