<br><font size=3>#include<stdio.h> </font>
<br><font size=3> main()</font>
<br><font size=3> {</font>
<br><font size=3> int a=555,*ptr=&a,b=*ptr;</font>
<br><font size=3> printf("%d %d %d",++a,--b,(*ptr)++);</font>
<br><font size=3>}</font>
<br><font size=2 face="sans-serif">Answer:</font>
<br><font size=2 face="sans-serif">for printf, arguments are evaluated
"right to left"</font>
<br>
<br><font size=2 face="sans-serif">so, </font><font size=3>(*ptr)++</font><font size=2 face="sans-serif">
increments the value of a by 1. the current value of a will be 556, but
(*ptr) still outputs as 555</font>
<br><font size=3>--b</font><font size=2 face="sans-serif"> = 554 , as expected</font>
<br><font size=3>++a</font><font size=2 face="sans-serif"> = preincrementing
a = hence a will be 556 + 1 =557</font>
<br><font size=2 face="sans-serif">hence the output!!</font>
<br>
<br><font size=2 face="sans-serif">--------------------------------------</font>
<br><font size=3>#include<stdio.h> </font>
<br><font size=3> main()</font>
<br><font size=3> {</font>
<br><font size=3> int a=555,*ptr=&a,b=*ptr;</font>
<br><font size=3> printf("%d %d %d",++a,--b,*ptr++);</font>
<br><font size=3>}</font>
<br>
<br><font size=2 face="sans-serif">Answer:</font>
<br><font size=3>*ptr++</font><font size=2 face="sans-serif"> = postincrementing
the pointer ptr, hence the output will be 555</font>
<br><font size=3>--b</font><font size=2 face="sans-serif"> = 554 as expected.</font>
<br><font size=3>++a</font><font size=2 face="sans-serif">= 556 , as expected!!</font>
<br>
<br><font size=2 face="sans-serif">Thanks,</font>
<br><font size=2 face="sans-serif">Murali.</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>"sowmya.k" <sowmi99@yahoo.com></b>
</font>
<br><font size=1 face="sans-serif">Sent by: linuxcprogramming-admin@lists.linux.org.au</font>
<p><font size=1 face="sans-serif">15/04/2004 06:46 PM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
linuxcprogramming</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">linuxcprogramming@lists.linux.org.au</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">[LCP]query regarding pointers
in C</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=3>pls tell me how these 2 pgms work</font>
<br><font size=3> </font>
<br><font size=3>1. #include<stdio.h> </font>
<br><font size=3> main()</font>
<br><font size=3> {</font>
<br><font size=3> int a=555,*ptr=&a,b=*ptr;</font>
<br><font size=3> printf("%d %d %d",++a,--b,(*ptr)++);</font>
<br><font size=3>}</font>
<br><font size=3> </font>
<br><font size=3>for this the output is 557 554 555</font>
<br><font size=3> </font>
<br><font size=3>2. #include<stdio.h> </font>
<br><font size=3> main()</font>
<br><font size=3> {</font>
<br><font size=3> int a=555,*ptr=&a,b=*ptr;</font>
<br><font size=3> printf("%d %d %d",++a,--b,*ptr++);</font>
<br><font size=3>}</font>
<br><font size=3> </font>
<br><font size=3>for this i got the output as 556 554 555</font>
<p><font size=2 face="Arial"><b>Could any one pls explain me the reson
behind this output</b></font>
<p><font size=3><b>Thanking you,</b></font>
<p><font size=3><b>Sowmya</b></font>
<p>
<hr><font size=2 face="Arial">Do you Yahoo!?<br>
Yahoo! Tax Center - </font><a href=http://taxes.yahoo.com/filing.html><font size=2 color=blue face="Arial"><u>File
online by April 15th</u></font></a>
<p>