I am using what scanf() returns when it gets what is expects or when it doesn't. What happens is it gets stuck in thewhile()` loop.
To my knowledge test = scanf("%d", &testNum); returns a 1 if it receives a number and a 0 if not.
My code:
#include<stdio.h>
int main(void) {
    while (1) {
        int testNum = 0;
        int test;
        printf("enter input");
        test = scanf("%d", &testNum);
        printf("%d", test);
        if (test == 0) {
            printf("please enter a number");
            testNum = 0;
        }
        else {
            printf("%d", testNum);
        }
    }
    return(0);
}
 
    