+ 2
What's the difference between the two? I gues both codes mean the same then why do I get an error?? Can anyone explain it to me?
https://code.sololearn.com/cZen583jRc96/?ref=app https://code.sololearn.com/csD09xrhAdlL/?ref=app
4 Réponses
+ 3
It ia not same.
In abc2 integer i is undefined in print function(since integer i is declarated in loop scope and function print is out of loop scope)
In second example you declare integer i before loop scope and function print and integer i is in the same scope
In both examples loop for has no commands since ; in the end of the line
+ 3
Yeahh that's correct... I got it... Thanks😊
+ 3
Ohh... I was not known to that thing... Thanks for the knowledge 😇😊
+ 2
Sneh Chauhan i remember that in visual studio 10 there was a setting named loop for scope and it was by default false. And this settings gives possibility to make abs2 example correct. But after VS12 this settongs become true by default and make error!!