As part of the Mario assignment following lecture 1, I need to determine is the number input is an integer. What function can I use to do that? I have tried scanf("%d", &number), where number is a declared integer type, but it doesn't seem to recognize float inputs.

And I can't find any reference of this in lecture 1.


get_int will automatically reject anything not an int

it’s mentioned in the spec:

  • Recall that you can get an integer from the user with get_int.
  • Recall that get_int is declared in cs50.h.
  • Recall that we used a do while loop to prompt the user for a positive integer in class via positive.c.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .