/******************************************************************************/ /* */ /* FILE: APRIL.CPP */ /* */ /* Operators can be funny even without overloading them. This is PLAIN C ... */ /* ========================================================================= */ /* */ /* Compiled and tested with Visual C++ V6.0 */ /* */ /* V1.00 29-APR-2000 P. Tellenbach http://www.heimetli.ch/ */ /* */ /******************************************************************************/ #include <stdio.h> int main( ) { char str[] = "Who Wrote This stupid Hello World Program ?" ; return printf( "%c. %c%.3s%c%c%x%cc%c\n", '\"'[str], *(str + 012), str + 'X' - 'A', *str + 0XEUL, --str[(main != (int (*)()) printf) << 1], '\n' | ('\n' / 2) & 1, str[37 < 38 ? 39 : 40], ('I','C','H') ^ ' ' ) ; }
Update 19. April 2020
This program compiled and ran without any changes, but a 4 warnings.
I eliminated two warnings but left the comma operator as it is.
While updating the code I noticed that the return value was wrong and added a comparison to correct this.
/******************************************************************************/ /* */ /* FILE: APRIL.CPP */ /* */ /* Operators can be funny even without overloading them. This is PLAIN C ... */ /* ========================================================================= */ /* */ /* Compiled and tested with Visual C++ V6.0 */ /* */ /* V1.00 29-APR-2000 P. Tellenbach http://www.heimetli.ch/ */ /* */ /* Compiled and tested with g++ V8.3.0 */ /* */ /* V2.00 19-APR-2020 P. Tellenbach https://www.heimetli.ch/ */ /* */ /******************************************************************************/ #include <stdio.h> int main( ) { char str[] = "Who Wrote This stupid Hello World Program ?" ; return printf( "%c. %c%.3s%c%c%x%cc%c\n", '\"'[str], *(str + 012), str + 'X' - 'A', (int)(*str + 0XEUL), --str[(main != (int (*)()) printf) << 1], '\n' | (('\n' / 2) & 1), str[37 < 38 ? 39 : 40], ('I','C','H') ^ ' ' ) != 14 ; }