Take a look at this very simple C program that does not check the length of the input. Try entering a username that is longer than 8 characters and watch what happens.
oops.c
{ // Buffer can only hold 8 characters! char buffer[8]; printf("Enter your username:\n"); scanf("%s", buffer); printf("You entered: %s\n", buffer); } int main() { while(1) askForUsername(); return 0; }
Running: "oops.c"