As far as I'm aware, there is no more allocation code. I don't even know enough to know what that really means. To show more code, here is how I use the first structure element that works:
Where it just sends the position array into the "move" function and changes it based on what command I gave (here I'm just moving a character around a 2D array of chars, and displaying - a 1 running around the screen, for example).
int preyh(char command, struct creatures *prey)
My main function is this:
I don't do anything with the structure anywhere else, so this should cover it. I just want to be able to feed the "pred" element into the move function as well, so that it can chase the "prey" around. I just don't understand why declaring it is crashing my program.
struct creatures prey1;
struct creatures pred;
printf("Please enter a command ('q' to quit).\n");
while(command != 'q');
Since I know nothing about memory allocation, maybe the problem is that I haven't been doing it? Can you suggest any resources online for learning more? (I am not taking a class nor do I have a book, I'm just learning because it is a useful skill to help me with my research, so I'm limited to free learning).