! is logical NOT. Something "is not" in C if it is false. The only false values are 0 and NULL. So if (!numofbees) will be true if numofbees == 0. "if (numofbees = !numofbees)" does not make much sense, lol -- I think it will just set numbofbees to either 1 or 0.
WRT to the return value of scanf():
Code:
printf("How many bees would you like to purchase?\n");
if (!scanf("%u", &numofbees)) { // ie, scanf returned 0
printf("Invalid amount, please try again.\n");
You could also use:
Code:
check = scanf("%u", &numofbees)
if (!check) { // ie, scanf() returned 0