c function return array of structs code example
Example: how to create and return a struct array in C
fentry *read_fentries(FILE *fp){
fentry *files[MAXFILES];
// EXTRACT FENTRIES AND FNODES FROM FILE
if ((fread(files, sizeof(fentry), MAXFILES, fp)) == 0) {
fprintf(stderr, "Error: could not read file entries\n");
closefs(fp);
exit(1);
}
return files;
}