Segmentation fault problem (C)

Posted by user228938 on Stack Overflow See other posts from Stack Overflow or by user228938
Published on 2010-05-14T16:21:45Z Indexed on 2010/05/14 16:24 UTC
Read the original article Hit count: 191

Filed under:
|

I have a struct named Game with an array of levels, defined like this:

typedef struct 
{
     Level levels[x];
} Game;

When I compile the code, if x is 1, 2 or 3, the program runs normally. If it's any other value (4, for instance), I get a segmentation fault. I'm not accessing the array anywhere. Main is something like this at the moment (commented everything except the initialization):

int main (...)
{
     Game g;

     return 0;
}

Any clue of what this might be?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about c

    Related posts about segmentation-fault