'When using getchar(), why do you need to clear the buffer for the enter key press in the first place?

I'm new to programming and learning C:

printf("What are your two initials?\n");
firstInit= getchar();
lastInit = getchar();

========================================

printf("What are your two initials?\n");
firstInit= getchar();
lastInit = getchar();
getchar();

I know that in the first section of code, if I type in ZK as initials, the Z will be placed in firstInit, and the '\n\ represented by the enter key will be placed into lastInit. The remaining K would be stored in a subsequent getchar(). However, in the second section of code, the book I'm reading said that if I type in ZK as initials, the firstInit will hold the Z, and the lastInit will hold the K. I just thought that the buffer needed to be cleared after each press of the enter key.

Sorry if this post is not allowed, will delete if needed.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source