lundi 2 décembre 2019

Why am I getting a SIGSEGV segmentation error in my program even when I am not using pointers?

I am trying to run the following program in Dev C++ 5.11, the code compiles but gives no output. When I tried using the debugger it gives me sigsegv segmentation error.

#include<iostream>

using namespace std;

int main()
{
    cout<<"hello";

    float u0[300][300][300], v0[300][300][300];
    const float umax = 1.5;
    const float vmax = 0.3; 
    for(int i=10; i<30; i++)
    {
        for(int j=10; j<30; j++)
        {
            for(int k=10; k<30; k++)
            {
                u0[i][j][k] = umax;
                cout<<u0[i][j][k]; 
            }
        }
    }

    for(int i=10; i<30; i++)
    {
        for(int j=10; j<30; j++)
        {
            for(int k=10; k<30; k++)
            {
                v0[i][j][k] = vmax; 
            }
        }
    }
    return 0;
}

Why am I getting the error? Can someone please help me out?

Aucun commentaire:

Enregistrer un commentaire