problem in VS2008

this pise of code is Smoottly run in VS2003 but not run in VS 2008
what is the wrung in the code please help me.

for (int i = 0 ; i<10;i++)
{//i++; // if remove the commnets than is run in both VS03-08
}
i++;
your problem isn't dependent on the environment, just look again carefully into your code.
variable i is valid only within the for loop scope. Outside it's just "unknown" for the compiler.

if you do like this:
1
2
3
4
5
//...
int i;
for(i = 0; i < 10; i++) {} 
i++;  //i = 11
//.. 


it will work fine


Last edited on
closed account (z05DSL3A)
If you look in the project properties in both VS 2003 and 2008, under C/C++ language you will find a setting for "Force Conformance in For Loop Scope". By default 2003 is no and 2008 is yes.
it looks like I have to study VS capabilities more and more
@Grey Wolf - I want to join to the thanks
Hi @Grey Wolf and johnkravetzki

Thank you very much for fast reply , i am new in this forms ,,its gr8 responce
becoze my project is very big and deadline is very soon thanks for now ...
Topic archived. No new replies allowed.