GeeksforGeeks » C/C++ Programming Questions
system programming (can anyone explain the output)
(2 posts)-
#include <stdio.h> #include <ctype.h> void fn(int x, int y); int main(void) { int a = 4; int b = -4; printf("[%s, %s, %c]\n", "\12" "3", "\123", "\123"); printf("[a: %d, b: %d]\n", a>>-1, b>>1); printf("Mod variants: 5,3 [Q: %2d, R: %2d]\n", 5/3, 5%3); printf("Mod variants: -5,3 [Q: %2d, R: %2d]\n", -5/3, -5%3); printf("Mod variants: 5,-3 [Q: %2d, R: %2d]\n", 5/-3, 5%-3); printf("Mod variants: -5,-3 [Q: %2d, R: %2d]\n", -5/-3, -5%-3); fn(a,a++); printf("[islower(’$’): %d], [islower(’a’): %d]\n", islower(’$’), islower(’a’)); return 0; } void fn(int x, int y) { printf("[x: %d], [y: %d]\n", x, y); } -
See section 7.5 of "C traps and pitfalls"
http://www.csd.uwo.ca/~moreno/cs2211_moreno/ctraps-AKoenig.pdf
Reply
You must log in to post.