Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

21
  • 11
    \$\begingroup\$ +1 for a marvellous answer. A little bit of explanation for those unfamiliar with C would be nice though. \$\endgroup\$ Commented Sep 3, 2015 at 15:52
  • 4
    \$\begingroup\$ @ace I believe this relies on C99-style comments. In the fourth line, notice the //**/. In C89, that's the division operator followed by an empty comment. In C99, // starts a single-line comment, so the rest of the line is blank. Therefore, in C89, it becomes (90-(-4.5/-4.5)), which is 89, while in C99, it becomes (90-(-4.5-4.5)), which is 99. \$\endgroup\$ Commented Sep 3, 2015 at 16:06
  • 15
    \$\begingroup\$ To save a few bytes, use 188-c instead of c==99?89:99. \$\endgroup\$ Commented Sep 3, 2015 at 19:24
  • 1
    \$\begingroup\$ @Qwertiy Calling undeclared functions is technically invalid in C99, as is leaving off the return type. \$\endgroup\$ Commented Sep 4, 2015 at 20:07
  • 1
    \$\begingroup\$ Yep. stackoverflow.com/q/26189962/4928642, but "After issuing the diagnostic, an implementation may choose to assume an implicit int and continue to translate the program in order to support existing source code that exploits this feature." \$\endgroup\$ Commented Sep 4, 2015 at 20:22