PrisonLove
Hard Realist
- Reaction score
- 78
Hey,
So the goal is to read input from the user using scanf(), which is easy enough, but I want to make certain that the user entered an integer, how would I do that? I'm making an integer linked list so the user needs to enter an int and I need to make sure that if he/she doesn't, they will be prompted again and again until they do.
This is a snippet of my code:
Any thoughts?
Thanks!
So the goal is to read input from the user using scanf(), which is easy enough, but I want to make certain that the user entered an integer, how would I do that? I'm making an integer linked list so the user needs to enter an int and I need to make sure that if he/she doesn't, they will be prompted again and again until they do.
This is a snippet of my code:
Code:
int userVal;
:
:
printf("Please enter an integer value: ");
scanf("%d", &userVal);
printf("\n");
curLoc = node_addAfter(curLoc, userVal);
Any thoughts?
Thanks!