I am a complete beginner in C and am having trouble reading details from a user. I have a function called getDetails and this is what's in it.
char firstName[MAX];
char lastName[MAX];
int idIn;
int number;
printf("First name: ");
scanf("%s \n", firstName);
int len = strlen(firstName);
firstName[len - 1] = '\0';
printf("Last name: ");
scanf("%s \n", lastName);
int len2 = strlen(lastName);
lastName[len2 - 1] = '\0';
printf("ID: ");
scanf("%d \n", &idIn);
printf("Number: ");
scanf("%d \n", &number);
MAX is defined as 100.
I get to enter first and last name but then it just skips the rest. I really can't see why this is happening either.