The following piece of code checks the users password, if it's not equal to the users password then it just asks them to enter their password again. The only problem is when i enter a character i.e. # or A or , the while loop i just runs continuously. I'm guessing it's because i've asked scanf to read in digits not chars, I'm not sure as to how i'm suppose to check both chars and ints using scanf at once?

Code:
   int password;
   printf("Please enter your password:");
   scanf("%d", &password);


   while (password != 233)
   {
      printf("%s", "Wrong password, please try again:");
      scanf("%d", &password);
   }