array 2d dynamic allocation c++
int** a = new int*[rowCount];
for(int i = 0; i < rowCount; ++i)
a[i] = new int[colCount];
array 2d dynamic allocation c++
int** a = new int*[rowCount];
for(int i = 0; i < rowCount; ++i)
a[i] = new int[colCount];
c++ allocate and free dynamic 2d array
// allocate
int** matrix = new int*[rowCount];
for(int i = 0; i < rowCount; i++)
matrix[i] = new int[colCount];
// free
for(int i = 0 ; i < rowCount; i++)
delete[] matrix[i]; // delete array within matrix
delete[] matrix; // delete actual matrix
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us