G
Gaijinco
I have always felt that you should only declared variables as needed,
and implicitily it seems many authors to encourage it, but the other
day a friend told me that declaring variables inside a loop wasn't good
practice, something like:
for(int i=0; i<size-1; ++i){
int aux = array;
array=array[i+1];
array[i+1]=aux;
}
should be written like:
int aux;
for(int i=0; i<size-1; ++i){
aux = array;
array=array[i+1];
array[i+1]=aux;
}
What do you think? Thaks!
and implicitily it seems many authors to encourage it, but the other
day a friend told me that declaring variables inside a loop wasn't good
practice, something like:
for(int i=0; i<size-1; ++i){
int aux = array;
array=array[i+1];
array[i+1]=aux;
}
should be written like:
int aux;
for(int i=0; i<size-1; ++i){
aux = array;
array=array[i+1];
array[i+1]=aux;
}
What do you think? Thaks!