#include<stdio.h>
#define prod(a,b) ((a>b)?a*a:b*b)
int prod1(int a,int b){
return ((a>b)?a*a:b*b);
}
int main(){
int p=0,q=-1;
int p1=0,q1=-1;
printf("%d ",prod(p1++,q1++));
printf("%d ",prod1(p++,q++));
return 0;
}
Output is: 1 0
Why is it different? How is the macros definition different from the function definition and why does it produces different results? Shouldn't all 2 outputs be equal to 0?