#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 |
What are the 4 types of organizational structures?
main() { intx=2,y=6,z=6; x=y=z; printf(%d",x) }
5 Answers Amazon, HCL, Thought Works,
struct tag{ auto int x; static int y; };main() { struct tag s; s.x=4; s.y=5; printf(ā%dā,s.x); }
To what value are pointers initialized? 1) NULL 2) Newly allocated memory 3) No action is taken by the compiler to initialize pointers.
Which is best book for data structures in c?
What is anagram in c?
write the output of following code .. main() { static int a[]={10,20,30,40,50}; int *ptr=a; static int arr[2][2]={1,2,3,4}; char str[]="ABCD * 4#"; char *s=str+2; int i,j; for(i=0;i<5,i++) printf("%d",*ptr++); for(i=0;i<2;i++) for(j=0;j<2;j++) printf("%d\n",*(*(n+i)+j)); printf("%c\n%c\n%c\n",*(str+2),*s++,*--s); }
How can I read in an object file and jump to locations in it?
What are the types of operators in c?
What is floating point exception error? And what are different types of errors occur during compile time and run time? why they occur?
c program to manipulate x=1+3+5+...+n using recursion
read an array and search an element