I was reading some literature about some overheads incurred in dynamic memory allocation when the following question came to mind.
What is the difference between how the following two blocks are compiled/allocated/executed..etc ?
ANDCode:while(true) { int x[100]; for(auto y : x) //do something with the values }
Code:while(true) { int *x=new int[100]; for(/*100 times*/) //do something with the values delete[] x; }