I wanted to limit the number of characters the user enters for a char array name using fgets, but it still allows the user to enter more than the number of characters it is allowed to enter. How I correct this problem? Below is my snippet code:
char name[15];
printf("Enter your name: ");
getchar();
fgets(name);