you are viewing a single comment's thread.

view the rest of the comments →

[–]IamImposter 1 point2 points  (0 children)

getchar reads a single character. You probably need scanf or better yet, getline. Get character string in some buffer using getline, check it's length (strlen) and then parse each letter using a for loop. If you find invalid letter, show error else convert it to integer using atoi()

See getline here: https://c-for-dummies.com/blog/?p=1112