Хочу вывести матрицу, однако возникает ошибка доступа в showMatrix(...)
#include <iostream>
class SquareMatrix {
private:
int n;
double** fullMatrixPointer;
public:
SquareMatrix(int dimMatrix) {
n = dimMatrix;
Hello();
fillMatrix(n, fullMatrixPointer);
showMatrix(n, fullMatrixPointer);
}
void Hello() {
printf("Hello fill matrix that have dim(3) \n %i", n);
}
void fillMatrix(short int n, double** fullMatrixPointer) {
fullMatrixPointer = new double*[n];
for (int i = 0; i < n; i++) {
fullMatrixPointer[i] = new double[n];
for (int j = 0; j < n; j++) {
printf("Введите элемент [%i][%i]: ", i, j);
std::cin >> fullMatrixPointer[i][j];
}
}
}
void showMatrix(int n, double** fullMatrixPointer) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
std::cout << fullMatrixPointer[i][j] << '\n';
}
std::cout << '\n';
}
}
};
int main() {
setlocale(0, "");
int dimMatrix = 2;
SquareMatrix matrix(dimMatrix);
}