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;
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.
Code Example |
---|
Cpp :: coordinate in 1d array |
Cpp :: c++ template function |
Cpp :: ViewController import |
Cpp :: check if character in string c++ |
Cpp :: combine two vectors c++ |
Cpp :: file c++ |
Cpp :: calloc c++ |
Cpp :: c++ friend class |
Cpp :: reverse function in cpp string |
Cpp :: c++ loop vector |
Cpp :: cstring to string |
Cpp :: time of a loop in c++ |
Cpp :: back() in c++ |
Cpp :: even and odd sum in c++ |
Cpp :: case label in c++ |
Cpp :: remove specific element from vector c++ |
Cpp :: ascii conversion cpp |
Cpp :: how to set a variable to infinity in c++ |
Cpp :: image shapes in opencv c++ |
Cpp :: #define online judge in cpp |
Cpp :: c++ contains |
Cpp :: tree to array c++ |
Cpp :: macros in c++ |
Cpp :: C++ Infinite while loop |
Cpp :: c++ Least prime factor of numbers till n |
Cpp :: c++ program to convert character to ascii |
Cpp :: cpp template |
Cpp :: c++ function of find maximum value in an array |
Cpp :: c++ data types |
Cpp :: vector from angle |