Float Array Prints Hello World
luna:~$ bat -p hello.c #include <stdio.h> int main(){ float buf[]={ 1.14313921243758250594e+27, 6.657848692049645644e+28, 7.73929309656277981375e−19, 0.0f }; puts((char*)buf); } luna:~$ clang hello.c luna:~$ ./a.out Hello World! luna:~$
A terminal shows C code storing strange floating-point values in an array, then casting the array to a character pointer and printing it as “Hello World!”. The joke is that the numbers secretly encode the text in memory, making an absurdly indirect way to print a classic beginner-programming message. It is used as a reaction to clever, cursed, or unnecessarily complicated code. EN: A terminal shows C code storing strange floating-point values in an array, then casting the array to a character pointer and printing it as “Hello World!”. The joke is that the numbers secretly encode the text in memory, making an absurdly indirect way to print a classic beginner-programming message. It is used as a reaction to clever, cursed, or unnecessarily complicated code.
- @ithueti / 543 2019-01-14
- Type
- image
- Size
- 458×438 · 31.6 KiB
- Mood
- absurd, clever
- Language
- en
- Added