Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- int num_rows = 8;
- int num_cols = 6;
- char **charBoard = new char*[num_rows+1];
- for(int i = 0; i<=num_cols; i++){
- charBoard[i] = new char[num_cols+1];
- }
- for (int i = 0; i <=num_rows; i++){
- delete[] charBoard[i];
- }
- //free the main array
- delete[] charBoard;
- return 0;
- }
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- int num_rows = 4;
- int num_cols = 6;
- char **charBoard = new char*[num_rows+1];
- for(int i = 0; i<=num_cols; i++){
- charBoard[i] = new char[num_cols+1];
- }
- for (int i = 0; i <=num_rows; i++){
- delete[] charBoard[i];
- }
- //free the main array
- delete[] charBoard;
- return 0;
- }
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- int num_rows = 4;
- int num_cols = 6;
- char **charBoard = new char*[num_rows+1];
- for(int i = 0; i<=num_cols; i++){
- ^^^^^^^^
- charBoard[i] = new char[num_cols+1];
- }
- for (int i = 0; i <=num_rows; i++){
- ^^^^^^^
- delete[] charBoard[i];
- }
- //free the main array
- delete[] charBoard;
- return 0;
- }
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- int num_rows = 4;
- int num_cols = 6;
- char **charBoard = new char*[num_rows+1];
- for(int i = 0; i<=num_rows; i++){
- charBoard[i] = new char[num_cols+1];
- }
- for (int i = 0; i <=num_rows; i++){
- delete[] charBoard[i];
- }
- //free the main array
- delete[] charBoard;
- return 0;
- }
Add Comment
Please, Sign In to add comment