#define f(x)
main()
{
printf("\n%d",f(2+2));
}

Answers were Sorted based on User's Feedback



#define f(x) main() { printf("\n%d",f(2+2)); }..

Answer / g.j.hemalatha

f(x) is an identifier.No constants is defined in the macro
definition.So the answer is a garbage value.

Is This Answer Correct ?    2 Yes 0 No

#define f(x) main() { printf("\n%d",f(2+2)); }..

Answer / priyadarshan kasta

it will show a error message as expression syntax error

Is This Answer Correct ?    1 Yes 0 No

#define f(x) main() { printf("\n%d",f(2+2)); }..

Answer / civa

Compiler Error "error: syntax error before ')' token"

Is This Answer Correct ?    1 Yes 1 No

#define f(x) main() { printf("\n%d",f(2+2)); }..

Answer / suman halder

within printf statement,f(2+2) i.e f(4) must return a value so that this value could get printed through %d format specifier..
Now,as f(x) is a macro template and macro expansion code for this template is not specified..so,here the situation is like,we are trying to return an integer value from a function which is having a "void" return type..
so,compiler flashes "Expression syntax error"..as during preprocessing macro template can't be replaced by macro expansion...

Is This Answer Correct ?    0 Yes 0 No

#define f(x) main() { printf("\n%d",f(2+2)); }..

Answer / hema

0

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

what is volatile in c language?

9 Answers   Cap Gemini, HCL, Honeywell, TCS, Tech Mahindra,


What was noalias and what ever happened to it?

0 Answers  


program to find the roots of a quardratic equation

1 Answers  


what are far pointers?

1 Answers  


marge linklist

0 Answers   HCL,






What should malloc() do?

0 Answers  


how can use subset in c program and give more example

0 Answers  


Explain the use of fflush() function?

0 Answers  


Which type of language is c?

0 Answers  


What header files do I need in order to define the standard library functions I use?

0 Answers  


what will be the output of" printf("%d%d",scanf("%d% d",&a&b));"

4 Answers  


What happens if you free a pointer twice?

0 Answers  


Categories