in Programming edited by
178 views
5 votes
5 votes

What will be the output of this program ?

#define square(x) x*x
main()
{
int z;
z = 25/square(5);
printf("%d",z);
}
in Programming edited by
by
178 views

1 Answer

8 votes
8 votes
Best answer
Explanation:
the macro call square(5) will substituted by 5*5 so the expression becomes z = 25/5*5 . Since / and * has equal priority the expression will be evaluated as (25/5)*5 i.e. 5*5 = 25
selected by

2 Comments

woah woah food for thought!!!
2
2
So, square(5) would not return the value of the expression, but the expression itself.

And then since / and * have equal priorities, left associativity would come into play. So, 25.

 

LOVED this question!
0
0
Answer:

Related questions