fgets gets skipped when i run my code. the scanf lines work just fine.
Here is the relevant code from a header file:
#ifndef UNTITLED16_FUNCTIONS_H
#define UNTITLED16_FUNCTIONS_H
struct student{
int studentID;
char studentName[100];
int age;
}student_t;
void get_information(){
printf("Type your student ID: ");
scanf("%i", &student_t.studentID);
printf("\nType your name: ");
fgets(student_t.studentName, 100, stdin);
printf("\nType your age: ");
scanf("%i", &student_t.age);
}
void print_information(){
printf("Student id: %i\n", student_t.studentID);
printf("Name: %s\n", student_t.studentName);
printf("Age: %i\n", student_t.age);
}
#endif //UNTITLED16_FUNCTIONS_H
Any ideas?