+ 1
Trouble with function like definitions
#include <stdio.h> #define func(x) x*x int main() { printf("%d",func(4-1)); return 0; } //Here I got output as -1 #include <stdio.h> #define func(x) (x)*(x) int main() { printf("%d",func(4-1)); return 0; } //Here I got output as 9 I thought both code were same but they are not. There is something I can't understand with these lines #define func(x) x*x #define func(x) (x)*(x) Can someone help me with this..
2 Réponses
+ 5
Yes , it works like this
1st one
4-1*4-1= -1
and 2nd one
(4-1)*(4-1)=9 because of (x)*(x)