C Primer Plus - Chapter 4 - Task 6 (string output)
Small sugggestion for printWhitespace(). You could do the following:

void printWhitespace(const unsigned int times) {
    printf("%*s", times, " ");
}


I have made the function argument const as it probably isn't meant to be modified. it is generally a good idea to be as "const" as possible as this avoids the mistake of writing to a variable that should be read-only.



I would put the array declarations at the top of the function before any of the code with a blank line between the declarations and the first line of code.



The function scanf can be used with caution... it can lead to buffer overflow attacks in the way it is used in your code. If the user enters a string longer than 19 characters (last character would be filled in as a null terminator in the buffer), scanf will just write on past the end of the buffer.

You could help guard against this by using scanf("%19s", firstName); and scanf("%19s", lastName);. As @chux points out the length is one less than the buffer size. This is because "String input conversions store a terminating null byte ('\0') to  mark end of the input; the maximum field width does not include this terminator." -- quote from man page.

Looked into this a little more and this SO answer, the author says:


  Note that the POSIX 2008 (2013) version of the scanf() family of
  functions supports a format modifier m (an assignment-allocation
  character) for string inputs (%s, %c, %[). Instead of taking a char *
  argument, it takes a char ** argument, and it allocates the necessary
  space for the value it reads


That would be a useful way of avoiding buffer overflow, but you must remember to free() the buffer returned.



The variable numOfWhitespace can also be const. Might put that to top of function too.



Your last bit of code that tries to align the numbers to the end of the words will only align properly if the string length is 9 or less. If the string length is greater then the number will be double digits so you could account for this.



Add return 0; to the end of the function. You reach the end of a non-void function without returning anything...



Hope that helps :)