I read Salem's link. It is correct in what it is saying about using prefix/postfix expression being undefined in certain cases. But this not what that is.
Thanks for the help on the coding
Sorry I made a typo in the code I posted. It should be:
Code:
//radius = (++radius) + (z++)
radius = radius + 1;
radius = radius + z;
z = z++;
//radius = (radius++) + (z++)
radius = radius + z;
radius = radius + 1;
z = z++;
Here is the test program I used for it
Code:
#include <stdio.h>
int main()
{
int radius = 21;
int z = 12;
//radius = (++radius) + (z++)
radius = radius + 1;
radius = radius + z;
z = z++;
//radius = (radius++) + (z++)
radius = radius + z;
radius = radius + 1;
z = z++;
printf ("Radius = %d", radius);
return 0;
}
Anyway, I forgot to metion I use this as in-class exercises after I have talked about prefix/postfix. I also give one example about prefix/postfix being undefined as well.
Any more questions that I can use.
Mr. C.