Вызвано исключение по адресу 0x00007FF8243AEFBB (ntdll.dll) в Стельмах15.exe: 0xC0000005: нарушение прав доступа при чтении по адресу

это файл с классом , пытался сделать класс-массив , в методе info выдаёт не обработанное исключения , облазил весь инет не нашёл ничего толкового .

    #ifndef MYCLASS_H
#define MYCLASS_H
#pragma once
#include <iostream>

#include <string>
#include <vector>
using namespace std;
class matrix
{
public:

    int rows, cols;

    void gen() {

        for (int i = 0; i < rows; i++) {
            pp[i] = new int[cols];
        }

        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                pp[i][j] = rand() % 100 - 100;
            }
            cout << endl;
        }

    }


    void info() {


    
        for (int i = 0; i < rows; i++)
        {
            for (int j = 0; j < cols; j++) {
                cout << pp[i][j] << " ";// вот тут выдаёт исключение
                cout << endl;
            }
            std::cout << std::endl;
        }



    }
    void executor() {

        for (int i = 0; i < rows; i++)
        {
            delete[]pp[i]; 
        }
        delete[] pp; 

    }




private:
    int** pp = new int* [rows];



};

#endif MYCLASS_H

Ответы (0 шт):