[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Fri Feb 13 12:01:29 2004 -->
- <!--x-from-r13: obo ng irelfrpheryvahk.pbz (Pbo Fbkra) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected]-a-geek.com --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] This is legal C: -->
- <li><em>date</em>: Fri Feb 13 12:01:29 2004</li>
- <li><em>from</em>: bob at verysecurelinux.com (Bob Toxen)</li>
- <li><em>in-reply-to</em>: <<a href="msg00434.html">[email protected]</a>></li>
- <li><em>references</em>: <<a href="msg00434.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] This is legal C:</li>
main(int argc, char **argv)
{
int j =2;
printf("Test: %c\n", "heck"[j]);
exit(0); /* Not all systems handle return 0; correctly. */
}
or for people who want good English (but not related to indices):
main(int argc, char **argv)
{
int j =2;
printf("We have %d item%s\n",
j, j == 1 ? "s" : "");
exit(0); /* Not all systems handle return 0; correctly. */
}
On Thu, Feb 12, 2004 at 10:40:09AM -0500, Bjorn Dittmer-Roche wrote:
> Someone sent me this. It's an interesting oddity. Try it on your
> favorite C compiler!
> bjorn
> --------------------------------------------------
> /* Find the strangeness! Spotted on kuro5hin... */
> #include <stdio.h>
> char *foo[] = {"what", "the", "heck", "is", "this"};
> int main(int argc, char **argv)
> {
> int j=2;
> printf("Test: %s\n", j[foo]);
> return 0;
> }
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00434" href="msg00434.html">[ale] This is legal C:</a></strong>
<ul><li><em>From:</em> bjorn at sccs.swarthmore.edu (Bjorn Dittmer-Roche)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00467.html">[ale] installing suse packages</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00469.html">[ale] OT: Cities/Counties/Zips by State?</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00444.html">[ale] This is legal C:</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00445.html">[ale] emerge rsync question</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00468"><strong>Date</strong></a></li>
<li><a href="threads.html#00468"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>