how to create and return a struct array in c

Solutions on MaxInterview for how to create and return a struct array in c by the best coders in the world

showing results for - "how to create and return a struct array in c"
María Paula
02 Feb 2019
1fentry *read_fentries(FILE *fp){
2    fentry *files[MAXFILES];
3
4    // EXTRACT FENTRIES AND FNODES FROM FILE
5    if ((fread(files, sizeof(fentry), MAXFILES, fp)) == 0) {
6        fprintf(stderr, "Error: could not read file entries\n");
7        closefs(fp);
8        exit(1);
9    }
10    return files;
11}