Assignment #4 - Pointers
Program functions with the following functions. The main program, which calls these functions, will be given at the lab. A structure type Student is given;
#define nameLength 40
typedef struct {
int age;
int ID;
float score;
char name[nameLength];
} Student;
1) Function ReadStudents that reads data from given file, stores them at a dynamically allocated memory space (by malloc function), and returns the address;
int ReadStudents(char* filename, Student **students)
The return value is the number of students read from the file, and the file format is as below;
21 201424156 3.58 Mal-Dong Kim
22 201322548 4.15 Soo-Min Lee
...
2) Function PrintID that prints the name of
student with ID;
int PrintID(Student *students, int n, int ID)
Note that n is the number of students. If the student with ID is found, then return 1, otherwise return 0.
3) Function SearchScore that prints the
names of students whose score are within [minScore, maxScore]
int SearchScore(Student *students, int n, float minScore, float maxScore)
The return value is the number of students whose scores are within the interval.
Oral Test on March 22