For example:
for (i = 0; i < 100; i++)
{
string myvar = "";
// Some logic
}
Do it make performace or memory leak?
Why i do this, because i don’t want “myvar” accessible outside the for..loop.
It is any performance monitor, i can compare the execute time between two snippet or whole program ?
thanks you.
No, variables are purely for the programmer’s convenience. It doesn’t matter where you declare them. See my answer to this duplicate question for more details.