On Mon, Oct 19, 2009 at 9:33 AM, Bilal Nawaz
<[email protected]> wrote:
> both these increments operator are same because of the following reasons
> 1.i++ is postincrement operator means it increments the next value of i after 
> printing that value
> for example
> (for int i=0;i<10;i++)
> {
> cout<<i<<endl;
> }
> after printing zero it will make increment
> whereas
> (for int j=0;j<10;++j)
> {
> cout<<j<<endl;
> }
> it will make increment first then print values of j in the given range

I suggest you run that through a compiler and then come back to correct it.

> regards
> bilal nawaz
>
>
>
>
> ________________________________
> From: Asad Abbas <[email protected]>
> To: c prog <[email protected]>; c4swimmers ygroup 
> <[email protected]>
> Sent: Sun, October 18, 2009 4:26:12 PM
> Subject: [c-prog] for loop i++ and ++i ?
>
>
> Why these both statements have same output??
> why i++ and ++i works alike in for loop??
>
>
> for(int i=0;i<5;i++)
> or
> for(int i=0;i<5;++i) ;
>    cout << i << endl;
>
> //output:
> /*
> 0
> 1
> 2
> 3
> 4
> */
>
> Thanx in Advance
> Asad Abbas
> UET Taxila
> Pakistan---- --------- --------- --------- --------- --------- ---------
>
> One of the main causes of the fall of the Roman Empire was that, lacking 
> zero, they had no way to indicate successful termination of their C programs.
> Robert Firth
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ------------------------------------
>
> To unsubscribe, send a blank message to 
> <mailto:[email protected]>.Yahoo! Groups Links
>
>
>
>



-- 
PJH

http://shabbleland.myminicity.com/
http://www.chavgangs.com/register.php?referer=9375
http://www.kongregate.com/?referrer=Shabble

Reply via email to