Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat hw106.c
- #include <stdio.h>
- int main() {
- int x = 2;
- printf("%d %d %d\n", x * x, ++x, x++);
- }
- $ clang -Wall -pedantic -std=c11 -o ../../bin/hw106C hw106.c
- hw106.c:6:31: warning: unsequenced modification and access to 'x' [-Wunsequenced]
- printf("%d %d %d\n", x * x, ++x, x++);
- ~ ^
- 1 warning generated.
- $ gcc-11 -Wall -pedantic -std=c11 -o ../../bin/hw106G hw106.c
- hw106.c: In function 'main':
- hw106.c:6:37: warning: operation on 'x' may be undefined [-Wsequence-point]
- 6 | printf("%d %d %d\n", x * x, ++x, x++);
- | ~^~
- hw106.c:6:37: warning: operation on 'x' may be undefined [-Wsequence-point]
- hw106.c:6:37: warning: operation on 'x' may be undefined [-Wsequence-point]
- $ ../../bin/hw106C
- 4 3 3
- $ ../../bin/hw106G
- 16 4 2
Add Comment
Please, Sign In to add comment