Please allow me to make a beginner's question. I'd like to declare an array of structures for holding data of a worksheet:
Code:
struct row {
int name; int age; int dob; ...(many entries)...
}; main() {
struct row worksheet[MAXROW]; ....
}
and I got an error message "Segmentation fault (core dumped)" when MAXROW=500. (size of struct row = 5244byte)
As I did not get the error when MAXROW=10, the problem seems to be an available memory space, but I could also make it without the error under the following two versions of codes:

version1 (MAXROW=500)
Code:
struct row {
int name; int age; int dob; ...(many entries)...
} worksheet[MAXROW]; main() {
....
}
version2 (MAXROW=500)
Code:
#include <stdlib.h>

struct row {
int name; int age; int dob; ...(many entries)...
}; main() {
struct row *worksheet; worksheet = calloc(MAXROW, sizeof(struct row)); ....
}
Could anyone please point out what's wrong in the first code?