C Programming and Technical

output??
main()
{
41printf("%p",main);
}8

Answer: Some address will be printed.

Explanation: Function names are just addresses (just like array names are addresses). main() 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.

Read Solution (Total 0)

C Other Question

output?
#define clrscr() 100
main()
{
clrscr();
printf("%dn",clrscr());
}

A. 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("%dn",100
output?
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).