// Programmer: Austin Guthals // Show that y=func(x)+z+func(x) is not always equal // to y=2*func(x)+z // my function will modify z #include #include void main() { int *x, y1, y2, z; x=&z; z=0; // initialize z to zero y1 = 2*func(x)+z; z=0; // since z will be changed I must reset z to zero y2 = func(x)+z+func(x); // Although z is changed, it doesn't // affect the final value because z is used before func(x) is called a //second time. func(x) will return a different value the second time printf("2*func(x) + z = "); printf("%d", y1); printf("\n"); printf("func(x) + z + func(x) = "); printf("%d", y2); printf("\n"); } int func(int *q) { int h; h = 2+(*q); *q = *q + 4; return h; }