how to fix ?"delete error"

Why there is an error in my code ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <cmath>
using namespace std;

void gen()
{
     int m[4][3];
    for(int h=0;h<2;h++)
    {
    for(int i=0;i<4;i++)
    {
        for(int j=0;j<3;j++)
        {
            m[i][j] = 1;
        }
    }

    }
    for(int i=0;i<4;i++)
    {
        delete []m[i];
    }
}

int main()
{
    gen();
    return 0;
}
Last edited on
You cannot delete what you didn't get with new
Topic archived. No new replies allowed.