scanf("%c") call seems to be skipped

Change

scanf("%c", &sex);

to

scanf(" %c", &sex);
       ^
      space

and

scanf("%c", &status);

to

scanf(" %c", &status);
       ^
      space

The problem is because of trailing newline characters after your second call to scanf(). Since it is of %d type specifier, when you press Enter A newline character ( '\n' ) is left in the stream and the next scanf() tries to read that newline character, and thus, it seems as though it just skipped input, but in fact, it read the newline character.

So, the newline character is stored in the variable sex, and thus, it skips asking you for input for that variable.


Unless you are interested in whitespace like newlines, do not use %c. Simply use the string conversion %s and use the first character of the input.

Rationale: All scanf conversion specifiers except %c ignore white space including newlines. They are designed to read sequences of input tokens (numbers, words) where the amount and nature of white space is irrelevant. The words can all be on the same line, or each word on a different line; scanf wouldn't care unless you force single character reads with %c which is almost never necessary.