When I was reading about the array initialization in this tutorial. I found out this note.
type name [elements];
NOTE: The e
Please check if the following answers help in giving you clarity about this.
Static array vs. dynamic array in C++
Static arrays are created on the stack, and necessarily have a fixed size (the size of the stack needs to be known going into a function): int foo[10];
Dynamic arrays are created on the heap. They can have any size, but you need to allocate and free them yourself since they're not part of the stack frame: int* foo = new int[10]; delete[] foo;
You don't need to deal with the memory management of a static array, but they get destroyed when the function they're in ends
Array size at run time without dynamic allocation is allowed?
C99 standard (http://en.wikipedia.org/wiki/C99) supports variable sized arrays on the stack. Some of the compilers might implement these standards and support variable sized arrays.