The char record[121] variable is actually an array of characters, otherwise known as a string. It is used here so that, if an erroneous input is given (instead of a valid integer input), then the input stream is still cleared by the fgets() call, which takes in all characters up to (and including) the newline character.
The sscanf function then attempts to extract a valid integer from the read character string and, if it fails, then an error value (-1) is assigned to signal that fact. If it succeeds, it assigns the given input value to number, in the same way that a successful call to scanf("%d", &number) would.
However, just using such a simple scanf() call would potentially leave 'unprocessed' characters in the input stream, which could cause problems for any subsequent input operations (or require the input stream to be cleared).
Using such a technique will also prevent undesired/unexpected effects caused by a user typing extra characters after a valid input. For example, the following (deliberately bad) code will cause a 'surprise' if you enter 1a in response to the first prompt:
#include <stdio.h>
int main()
{
int number = 0, number2 = 0;
printf("Enter first number: ");
scanf("%d", &number);
printf("Enter second number: ");
scanf("%d", &number2);
printf("Given numbers were: %d and %d.\n", number, number2);
return 0;
}
However, using the getNum() function your teacher provided, the following code is much more robust:
int main()
{
int number = 0, number2 = 0;
printf("Enter first number: ");
number = getNum();
printf("Enter second number: ");
number2 = getNum();
printf("Given numbers were: %d and %d.\n", number, number2);
return 0;
}