/* File: side_effect.c This program demonstrates expressions with side effects and the fact that order of evaluation in a C expression is not predictable. */ #include main() { int n = 2 ; /* The following expression has no side-effects */ 1 * 2 + 3 / 4 - 5 - 6 + 7 - 8 ; printf("n = %d\n", n) ; /* The following expression has a side-effect */ n = 5 - n ; printf("n = %d\n", n) ; /* The following expression has unpredictable side-effects. THIS IS BAD PROGRAMMING STYLE */ n = (n = 10) * 4 + (n = n * 10) * 2 ; printf ("n = %d \n", n) ; }