Another C Code Joke

$ pcat goes-to.c #include <stdio.h> int main() { int x = 5; // while x goes to 0: while (x --> 0) { printf("%d ", x); } printf("\n"); return 0; } $ gcc goes-to.c && ./a.out 4 3 2 1 0

March 27, 2022 · 1 min · un01s

C Code Jokes

Here are some C code with the JavaScript quirks. Credits to luna. #include <stdio.h> int main() { puts("-0.5" + 1); printf("%d\n", 50 ** "2"); return 0; } To build and run the above code, just do the following and ignore the warnings. $ gcc c-js.c && ./a.out 0.5 2500 Let’s look at the warnings first. c-js.c:4:15: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] puts("-0.5" + 1); ~~~~~~~^~~ c-js....

March 18, 2022 · 1 min · un01s