!isdigit isnt working (C programming)
<p>I'm trying to create a random number guessing game that generates a random number between 1-10 and have the user guess it. It then tells the user if they're right or not. That part works fine, but the problem also asked for me to utilize the isdigit() function. I cannot get this to work for some reason. It says everything is a digit.</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;ctype.h&gt;
#include &lt;time.h&gt;

int main(){

    srand(time(NULL));
    int x;
    int r;

    r=(rand() %10)+1;
    r=6;
    printf(" Select a number between 1 and 10 \n");
    scanf(" %d", &amp;x);

    if(!isdigit(x)){
        if(x==r)
            printf("Congratulations, you guessed correctly! \n");


    else{
        printf("Uh oh! You guessed the wrong number! \n");
        printf("The correct guess was %d \n",r);
}


    }
    else{
        printf("That is not a number! \n");

}
}
</code></pre>