+ 1
Help!
Can we declare variables inside while loop just like for loop . Explain with example
3 RĂ©ponses
+ 2
I Don't think so
+ 2
no practically you can't.......
but you could define the scope around it so variable gets destroyed I think below example will make more sense
if you want:
for(int i =something; condition; expression){
}
can be replaced with while like....
{
int i = something;
while(condition){
//inside while loop
}
}//i will be destroyed at this point.
+ 1
no