#define f(x)
main()
{
printf("\n%d",f(2+2));
}
Answers were Sorted based on User's Feedback
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 |
Answer / priyadarshan kasta
it will show a error message as expression syntax error
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / civa
Compiler Error "error: syntax error before ')' token"
| Is This Answer Correct ? | 1 Yes | 1 No |
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 |
Explain the difference between #include "..." And #include <...> In c?
What is the purpose of the preprocessor directive error?
What is a double c?
What is variables in c?
Explain the difference between struct and union.
what is link list?
What is a const pointer, and how does it differ from a pointer to a const?
What is hash table in c?
which of 'arrays' or 'pointers' are faster?
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?
Whats wrong with the following function char *string() { char *text[20]; strcpy(text,"Hello world"); return text; }
How will you allocate memory to a double pointer ?