delete 2d dynamic array c++
for (int i = 0; i < numRows; i++) {
delete [] world[i];
// world[i] = 0; // <- don't have to do this
}
delete [] world; // <- because they won't exist anymore after this
world = 0;
delete 2d dynamic array c++
for (int i = 0; i < numRows; i++) {
delete [] world[i];
// world[i] = 0; // <- don't have to do this
}
delete [] world; // <- because they won't exist anymore after this
world = 0;
delete specific row from dynamic 2d array c++
string** new_array = array;
for(int i=0; i<numRows; i++){
new_array = new string[coloumns]
if(i != n){ // <- if you want to delete nth row then
new_array[i] = array[i];
}
}
array = new_array; // <- now array excluding nth row is saved in this pointer.
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