When I compile my code with GCC and then I run it, when I call my function into my code, it prints out: "Segmentation fault (core dumped)".
I tried searching on google for solutions.
Here is my current code:
char ** saveLevelPositions() {
int x, y;
char ** positions;
positions = malloc(sizeof(char *) * 25);
for (y = 0; y < 25; y++) {
positions[y] = malloc(sizeof(char) * 100);
for (x = 0; x < 100; x++) {
positions[x][y] = mvinch(y, x);
}
}
return positions;
}
I expected the function to just run properly and it just gives a segmentation error.
EDIT: For a little bit of context, here is a link to the GitHub project: https://github.com/xslendix/rogue