#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

Display names and numbers of employees who have 5 years or more experience and salary less than Rs.15000 using array of structures (name, number, experience and salary)

1 Answers  


How to set file pointer to beginning c?

0 Answers  


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

0 Answers  


write c program to display output 10(10+20)+(10+20+30)+ ... n term

0 Answers   Hindustan Gum Chemicals,


What is the difference between the local variable and global variable in c?

0 Answers  






int zap(int n) { if(n<=1)then zap=1; else zap=zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap [a] 8 [b] 9 [c] 6 [d] 12 [e] 15

10 Answers   Wipro,


write a program to create a sparse matrix using dynamic memory allocation.

0 Answers  


Explain that why C is procedural?

0 Answers   Maveric, Verifone,


how to devloped c lenguege?

4 Answers  


What is the use of static variable in c?

0 Answers  


write a c program to add two integer numbers without using arithmetic operator +

13 Answers   Value Labs,


write a c program to find largest of three numbers using simple if only for one time.

1 Answers  


Categories