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