I am given an exercise that I can't seem to understand. I am almost done with my assignment but I'm stuck on this function.
Limitations: There can only be 10 unique student ID's. There are 5 subject area of study. An a student can only take 2 subjects.
My struct.h look like this:
typedef struct student_info{
int student_id;
int course_id[2];
}student;
In main.c
student info[10];
In func.c
Say I Prompt the user for a Student ID.
printf("Enter Student ID. ");
scanf("%d", &info->student[count_stud]->student_id;
User inputs 123
Then Prompt the user for a course ID.
printf("Enter Course ID. ");
scanf("%d", &info->student->course_id[count_cour];
User inputs 101
My problem lays with printing out a specific student_id and the course that student is taking. Also using a for loop I couldn't find a way to find a duplicate. I can find an id that was last inputted by the user but when I enter an id from 2 previous inputs it passes my if else statements.
Any help is appreciated.
scanf("%d", &info[count_stud].student_id);,scanf("%d", &info[count_stud].course_id[count_cour]);&info->student[count_stud]is just wrong.