Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There could be multiple reasons why a 2D dynamic array is not increasing in size in C++. Some common reasons include:

  1. Incorrect allocation: If the dynamic array is not allocated properly, it may not increase in size. It is important to use the correct C++ keyword (new or malloc) to allocate memory for the dynamic array.

  2. Memory leaks: If the dynamic array is not deleted properly, it may lead to memory leaks, which can prevent the array from increasing in size.

  3. Insufficient memory: If there is not enough memory available on the system, the dynamic array may not increase in size. It is important to check the available memory before trying to resize the array.

  4. Incorrect resizing logic: If the logic to increase the size of the array is incorrect or flawed, the dynamic array may not increase in size as expected.

  5. Incorrect indexing: If the indices used to access the array are incorrect, the dynamic array may not increase in size. It is important to use the correct indices to access the array elements.