What will be the output of the following program?
#include<stdio.h>
#define prod(a,b) a*b
void main()
{
int x=3 y=4;
printf("%d", prod(x+2,y-1));
}
015
010
0 12
11
None of these
Answers
Answered by
0
Answer:
010 will be the answer
Explanation:
The code compile as follows
Here you used the preprocessor in the program
So the code will be substitute preprocessor code when it encounter the preprocessor name
=>we have passed x+2 and y-1 in the preprocessor function
The code of preprocessor is a*b
So the x+2 and y-1 will be treated as an equation as
x+2*y-1
Here x and y values are 3, 4 reapectively
So=>
3+2*4-1
Accoeding to the operators precedence /, *, +, - will be performed in order
=>3+8-1
=>11-1
=>10 so the output will be 10
HOPE IT HELPS YOU
DO FOLLOW FOR MORE ANSWERS
MARK AS BRAINLIEST
Similar questions