scope issue

patrick patrick@mail.boxsoft.com
Mon Aug 23 21:19:00 GMT 1999


sometime in the late 1900s Dima replied to Richard:

> Richard Harvey Chapman wrote:
> 
> > Is there a correct output for the following?
> 
> No, there isn't.


i can understand your answer for the second printf() but not
for the first one.

i think the first one should always give 9 (in this case).

what am i missing?


> > int main ( void )
> > {
> >   int x=9;
> >
> >   printf ("%d\n", (x + x++) - --x);
> >   printf ("%d %d\n", ++x, x++);
> > }
> >
> > I believe that it should be:
> > 9
> > 10 10
> >
> > but different compilers have given different answers.
> >
> > R.
> 
> Dima




patrick at boxsoft dot com
sidster at drink dot com

--
The rain it raineth on the just
        And also on the unjust fella,
But chiefly on the just, because
        The unjust steals the just's umbrella.


More information about the Gcc mailing list