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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of Macro over function?

1182


Why n++ execute faster than n+1 ?

1825


Can the sizeof operator be used to tell the size of an array passed to a function?

608


Difference between malloc() and calloc() function?

648


Why doesn't C support function overloading?

1596






Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1452


What is n in c?

566


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

858


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

902


Define the scope of static variables.

596


Explain what is the benefit of using const for declaring constants?

604


What is the difference between the = symbol and == symbol?

616


For what purpose null pointer used?

600


When should volatile modifier be used?

544


What is page thrashing?

645