629 views
0 votes
0 votes

What will be the output of the following program

#define abc(x,y) x*y
void main()
{
    int a=1, b=2;
    printf("%d", abc(a+1, b-2));
}

A) 0

B) 1

C) 2

D) 3

1 Answer

Best answer
3 votes
3 votes

given macro is resolved in the following way :

printf("%d", a+1*b-2);

therefore 1+1*2-2

which gives answer = 1 

selected by

Related questions

0 votes
0 votes
3 answers
1
Sankaranarayanan P.N asked Oct 27, 2016
580 views
What is the output of this C code?#include<stdio.h int main() { do printf("Inside while loop"); while(0); printf("After while loop"); }A) Infinite loopB) Compilation erro...
0 votes
0 votes
2 answers
2
Sankaranarayanan P.N asked Oct 27, 2016
846 views
The default parameter passing mechanism of functions is A) Call by ValueB) Call by ReferenceC) Call by ResultD) None of the above
3 votes
3 votes
2 answers
3
Sankaranarayanan P.N asked Oct 27, 2016
411 views
What will be the output of the following C program fragment?int n =1; switch(n) { case 1: printf("One"); case 2: printf("Two"); case 3: case 4: case 5: default: printf("W...
2 votes
2 votes
1 answer
4
Sankaranarayanan P.N asked Oct 27, 2016
323 views
int add(int a) { static int count = 0; count = count + a; return(count); } main() { int a, b; for(a=0; a<=4; a++) b=add(a); }What is the value of b at the end of executio...