[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



> 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!
>
> What's strange about it. [ is a commutative operator, so a[i] and i[a]
> represent the same thing i.e. *(a+i). The reason the compiler doesn't complain
> is that printf takes a void pointer in that spot, so since the result is a
> char *, no worries.

Well, y'all are too smart I guess -- I always figured the compiler
expected a pointer as a and an int as i in a[i], although I knew how
*(a+i) worked. Perhaps this is more of a novelty with java
programmers.....

	bjorn


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00438" href="msg00438.html">[ale] This is legal C:</a></strong>
<ul><li><em>From:</em> jtaylor at onlinea.com (J.M. Taylor)</li></ul></li>
</ul></li></ul>
<!--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>
<li><strong><a name="00436" href="msg00436.html">[ale] This is legal C:</a></strong>
<ul><li><em>From:</em> byron at cc.gatech.edu (Byron A Jeff)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00436.html">[ale] This is legal C:</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00438.html">[ale] This is legal C:</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00436.html">[ale] This is legal C:</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00438.html">[ale] This is legal C:</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00437"><strong>Date</strong></a></li>
<li><a href="threads.html#00437"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>