Posted: Mon Apr 21, 2014 7:11 pm Post subject: Re: [C/C++/C#]Question in programming
Vibrate wrote:
Hello,
I am a new member so please no offense.
Does it matter if i do this:
1. int i;
2. for(i = 0; i < 10; i++)
3. {
expression
}
so does it matter if the 1. number would be this or this:
int i = 0;
OR
int i;
Does it matter?
Thank you!
Doesn't matter, since you're initializing i twice - once at instantiation and once when you setup your loop. In modern C++, it's common to use a "for(int i=0;..." form, so that i is scope-limited to the loop. The theory is that it makes your program more resilient to later updates. _________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum