1. The ++x won't get compiled either :)

Regards,
Paul Johnson
Applewood House
www.applewoodhouse.com


----- Original Message -----
From: "Aaron Ardiri" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Tuesday, June 24, 2003 8:18 PM
Subject: Re: offtopic: who can figure out this for loop


> > Not really PalmOS related, but hey you can run it on your Handheld:
> >
> >   int x = 1;
> >   for( int i = 0; i < 100; ++i );
> >     // What will the next line do? Increment???????????/
> >     ++x;
> >
> > what's the value of x after this code ran on a standard c++ compiler?
>
> 2.
>
> why?
>
> >   for( int i = 0; i < 100; ++i );  <-- see that ';'
>
> the compiler interprets this code as:
>
> int x = 1;
> for (int i=0; i<100; i++)
> {
> }
> ++x;
>
> basic C :)
>
> ---
> Aaron Ardiri                        [EMAIL PROTECTED]
> CEO - CTO                                           +46 70 656 1143
> Mobile Wizardry                      http://www.mobilewizardry.com/
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to