Probably a stupid question... but is it generally more efficient to declare a variable within a loop, i.e.
or outside of it, i.e.Code:for(i = 0; i<10; i++) { int n; n = someArray[i]; // for instance ... do some stuff with n }
I'd always assumed the latter, but I've seen some examples of the former in what I thought was pretty optimised code.Code:int n; for(i = 0; i<10; i++) { n = someArray[i]; // for instance ... do some stuff with n }
Thanks.