The code I wrote compiles without errors thus I don't know the reason an error is ocurring.
#pragma once
class Macierz
{
public:
class Wiersz
{
public:
    int *tab;
    int dlugosc;
    Wiersz(int d);
};
int x;
int y;
Wiersz *wiersze;
public:
Macierz(int m, int n);
Macierz(Macierz &m);
Macierz & operator+(Macierz &m);
Macierz & operator-(Macierz &m);
Macierz & operator*(Macierz &m);
Macierz & operator=(Macierz &m);
int& operator()(int x, int y);
string to_String();
};
#include "stdafx.h"
#include "Macierz.h"
Macierz::Macierz(int _x, int _y) :x(_x), y(_y)
{
Wiersz **tab = new Wiersz*[_x];
for (int i = 0; i < x; i++)
    tab[i] = new Wiersz(_y);
wiersze = *tab;
}
Macierz::Macierz(Macierz &m) :Macierz(m.x, m.y)
{
for (int i = 0; i < x; i++)
    for (int j = 0; j < y; j++)
        wiersze[i].tab[j] = m.wiersze[i].tab[j];
}
Macierz & Macierz::operator+(Macierz &m)
{
if (x != m.x || y != m.y) throw "Macierze maja rozne rozmiary";
Macierz *temp = new Macierz(m);
for (int i = 0; i < x; i++)
    for (int j = 0; j < y; j++)
        (*temp).wiersze[i].tab[j] += wiersze[i].tab[j];
return *temp;
}
Macierz & Macierz::operator-(Macierz &m)
{
if (x != m.x || y != m.y) throw "Macierze maja rozne rozmiary";
Macierz *temp = new Macierz(m);
for (int i = 0; i < x; i++)
    for (int j = 0; j < y; j++)
        (*temp).wiersze[i].tab[j] -= wiersze[i].tab[j];
return *temp;
}
Macierz & Macierz::operator*(Macierz &m)
{
Macierz *temp;
if (x == m.y)
{
    temp = new Macierz(m.x, y);
    for (int i = 0; i < (*temp).x; i++)
        for (int j = 0; j < (*temp).y; j++)
            for (int l = 0; l < m.y; l++)
                (*temp).wiersze[i].tab[j] += wiersze[i].tab[l] * m.wiersze[l].tab[j];
}
else if (y == m.x)
{
    temp = new Macierz(x, m.y);
    for (int i = 0; i < (*temp).x; i++)
        for (int j = 0; j < (*temp).y; j++)
            for (int l = 0; l < y; l++)
                (*temp).wiersze[i].tab[j] += wiersze[i].tab[l] * m.wiersze[l].tab[j];
}
else throw "Rozmiary macierzy sie nie zgadzaja";
return *temp;
}
Macierz & Macierz::operator=(Macierz &m)
{
for (int i = 0; i < x; i++)
    for (int j = 0; j < y; j++)
        wiersze[i].tab[j] = m.wiersze[i].tab[j];
return *this;
}
int& Macierz::operator()(int x, int y)
{
return wiersze[x].tab[y];
}
Macierz::Wiersz::Wiersz(int i)
{
dlugosc = i;
tab = new int[dlugosc];
}
string Macierz::to_String()
{
std::ostringstream str;
str << "|";
for (int i = 0; i < x; i++)
{
    for (int j = 0; j < y; j++)
        str << wiersze[j].tab[i] << ",";
    str << "\b|\n";
}
return str.str();
}
Using constructor in main doesn't crash the program:
Macierz m1(1,1);
However there seems to be a problem with accesing to certain data field, e.g.
 m1(0,0) = 1; 
(at least this is a code line at which some yellow arrow points)
Program is used for operations on matrix(+, -, *). I wrote a program in similar fashion for euclidean vector operations which works perfectly.
Thanks for help in advance.
 
     
     
    