How can I 'error check' the scanf function so that when I do:

scanf("%d", &t);

it won't go berserk if a non-decimal number (or character) is entered?