The following is a snippet of my C program:
a = 5; b = 7;
printf("\ncubef(--a) = %d", cubef(--a));
a = 5; b = 7;
printf("\ncubem(--a) = %d", cubem(--a));
Where cubef and cubem are defined as follows:
#define cubem(a) a*a*a
int cubef(int a) { return a * a * a; }
When executed, I get the following output:
cubef(--a) = 64
cubem(--a) = 18
I understand that cubem "expands" to --a*--a*--a
which should result in 4*3*2
which equals 24, but for some reason I am getting 18. Can someone help me understand how I am getting that output?
Here is a link to the full program, if required: https://pastebin.com/7hGYJkTi