I've read various google links and everyone seems to have a different way for dealing with formatted input in C and non of them seem to work for me so I'm looking for any suggestions. I want to accept an integer, a string(max 15), a string(max 20), and a float entered all at once. I've tried the following ideas but none work. I honestly don't care what approach will work, I'm just trying to find something. These are the 2 closest things I've gotten working, the first one works on correct input but fails on incorrect input (enters an infinite loop and never returns to the menu), and the 2nd just enters an infinite loop on both cases.

Code:
case 'i':
{
   struct node* new = malloc(sizeof(struct node));
   int correct = scanf("%d%15s%20s%f", &new->custId, &new->Name, &new->Surname, &new->accBalance);
   if (correct == 4)
   {
      add(&head, new);
   }
   else
   {
      printf("Invalid entries\n");
      free(new);
      int clearScanfBuffer = 0;
      while ((clearScanfBuffer = getchar()) != '\n');
   }
   break;
}
//This code works if you enter perfectly correct input but fails on incorrect input.
I'd like to return to the menu to try a new option but it doesn't go there
it just lets me keep typing whatever I want on the keyboard in some infinite loop
Code:
case 'i':
{
   char myString[100];
   fgets(myString, 100, stdin);
   struct node* new = malloc(sizeof(struct node));
   int correct = sscanf(myString, "%d%15s%20s%f", &new->custId, &new->Name, &new->Surname, &new->accBalance);
   if (correct == 4)
   {
      add(&head, new);
   }
   else
   {
      printf("Invalid entries\n");
      free(new);
   }
   break;
}
//This just doesn't work at all.  It never exists some loop even on correct input.