Problem using structures (they crash my program)
I'm just learning structures, and I'm having some trouble. The following is the structure I delcared globally:
Code:
struct creatures
{
int *position;
};
and the next is when I declare members of the structure in my main function:
Code:
char command;
struct creatures prey1;
struct creatures pred;
Now, if you need to know more I can post more code, but I don't think it's necessary. Basically, my program runs perfectly fine. Only, if I so much as declare the second member (struct creatures pred), the program crashes on startup. If I comment out that line, everything works as intended again. Wtf? I'm not even doing anything with it yet! Any help would be greatly appreciated.