What is the difference between a static array and a dynamic array in C++?
I have to do an assignment for my class and it says not to use static arrays, only dynamic
Static arrays are allocated memory at compile time and the memory is allocated on the stack. Whereas, the dynamic arrays are allocated memory at the runtime and the memory is allocated from heap.
int arr[] = { 1, 3, 4 }; // static integer array. int* arr = new int[3]; // dynamic integer array.