Just for the future be very cautious when you use something like this
Code:
#include <stdio.h>
#define MAX(x,y) ((x)>(y)?(x):(y))
int main(void)
{
int x=5,y=3;
printf("max=%d\n", MAX(x++,y));
return 0;
}
It will give me output 6
Code:
#include <stdio.h>
#define MAX(x,y) ((x)>(y)?(x):(y))
int main(void)
{
int x=5,y=3;
printf("max=%d\n", MAX(++x,y));
return 0;
}
It will give me output 7
This happens because what is in the place of x ( in line where you have the #define ) will be executed too. Same for y.