Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct student_s {
- char name[MAX_NAME_SIZE];
- int age;
- Student* next; // Pointer to next student in a list
- };
- typedef struct student_s Student;
- Student* readStudents(FILE *file)
- {
- Student* first = NULL; // Pointer to the first student in the list
- Student* last = NULL; // Pointer to the last student in the list
- Student* student = readOneStudent(file);
- while (student != NULL) {
- if (first == NULL) {
- first = last = student; // Empty list case
- } else {
- last->next = student;
- last = student;
- first = last;
- }
- student= readOneStudent(file);
- }
- return first;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement