My question is that does it matter if I declare a variable outside the loop and reinitialize every time inside the loop or declaring and initializing inside the loop? So basically is there any difference between these two syntaxes (Performance,standard etc)?
Method 1
int a,count=0;
while(count<10)
a=0;
Method 2
int count=0;
while(count<10)
int a=0;
Please assume that this is only a part of a bigger program and that the body inside loop requires that the variable a
have a value of 0
every time. So, will there be any difference in the execution times in both the methods?