#include<iostream>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int **arr;
arr = new int *[n];
for (int i = 0; i < n; i++) {
arr[i] = new int [m];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> arr[i][j];
}
}
for (int i = 0; i < n; i++) {
int sum = 0;
for (int j = 0; j < m; j++) {
sum += arr[i][j];
}
cout << sum << endl;
}
for (int i = 0; i < n; i++) {
delete []arr[i];
}
delete []arr;
return 0;
}
tại sao arr = new int *[n] chạy nhưng arr[i] = new int *[m] lại không chạy vậy? và theo e biết thì khi nào mình tạo biến con trỏ thì mới cấp phát bộ nhớ (new int) vậy tại sao [m] lại dùng? nếu e hiểu sai thì xin thông cảm ạ