Guest User

Untitled

a guest
Sep 18th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. int num_rows = 8;
  8. int num_cols = 6;
  9.  
  10. char **charBoard = new char*[num_rows+1];
  11. for(int i = 0; i<=num_cols; i++){
  12. charBoard[i] = new char[num_cols+1];
  13. }
  14.  
  15. for (int i = 0; i <=num_rows; i++){
  16. delete[] charBoard[i];
  17.  
  18. }
  19. //free the main array
  20. delete[] charBoard;
  21.  
  22. return 0;
  23. }
  24.  
  25. #include <iostream>
  26. #include <fstream>
  27. using namespace std;
  28.  
  29. int main(){
  30.  
  31. int num_rows = 4;
  32. int num_cols = 6;
  33.  
  34. char **charBoard = new char*[num_rows+1];
  35. for(int i = 0; i<=num_cols; i++){
  36. charBoard[i] = new char[num_cols+1];
  37. }
  38.  
  39. for (int i = 0; i <=num_rows; i++){
  40. delete[] charBoard[i];
  41.  
  42. }
  43. //free the main array
  44. delete[] charBoard;
  45.  
  46. return 0;
  47. }
  48.  
  49. #include <iostream>
  50. #include <fstream>
  51. using namespace std;
  52.  
  53. int main(){
  54.  
  55. int num_rows = 4;
  56. int num_cols = 6;
  57.  
  58. char **charBoard = new char*[num_rows+1];
  59. for(int i = 0; i<=num_cols; i++){
  60. ^^^^^^^^
  61. charBoard[i] = new char[num_cols+1];
  62. }
  63.  
  64. for (int i = 0; i <=num_rows; i++){
  65. ^^^^^^^
  66. delete[] charBoard[i];
  67.  
  68. }
  69. //free the main array
  70. delete[] charBoard;
  71.  
  72. return 0;
  73. }
  74.  
  75. #include <iostream>
  76. #include <fstream>
  77. using namespace std;
  78.  
  79. int main(){
  80.  
  81. int num_rows = 4;
  82. int num_cols = 6;
  83.  
  84. char **charBoard = new char*[num_rows+1];
  85. for(int i = 0; i<=num_rows; i++){
  86. charBoard[i] = new char[num_cols+1];
  87. }
  88.  
  89. for (int i = 0; i <=num_rows; i++){
  90. delete[] charBoard[i];
  91. }
  92. //free the main array
  93. delete[] charBoard;
  94.  
  95. return 0;
  96. }
Add Comment
Please, Sign In to add comment