Check if User Inputs a Letter or Number in C

It’s best to test for decimal numeric digits themselves instead of letters. isdigit.

#include <ctype.h>

if(isdigit(variable))
{
  //valid input
}
else
{
  //invalid input
}

Leave a Comment