
Originally Posted by
gloryhunter
postincrement and preincrement exercise.
void f(int, int);
main()
{
Â* int x = 5;
Â* printf("x : %d \t\t %d\n", x++, ++x); // ang outpuit ani is x: 6Â* 6
Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* // x is now 7, because it's postincremented by 1
Â* f(x, x++);Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â* Â*// C evaluates the left param first, then postincremented
}
void f(int x, int y)
{
Â* printf("f : x = %d \t y = %d\n", x, y); // y = 7,Â* since it's postincrementedm x:8
}