Somebody asked me a question: Which one is the fastest among the below two scenario:
for (int i = 0; i < 10; i++)
{
this is the only example i can think of where it matters which variable you iterate where
int array[n][m];
//fast
for (int i=0;i
the second one is slower because you don't iterate the locations in memory one after the other, but because you jump by m locations at a time. the processor caches the memory locations positioned immediately after an accessed location.