This seemingly trivial piece of code is copied from the textbook but after Xcode takes the input at the scanf(), the program exits with error code -1 and says \"lost connection\
Since the program expects an integer value to be inputted, I was hitting the "Enter" key on my keyboard (on the number pad). The scanf method terminates user input after the "Return" key is pressed. Although they are both often referred to as "Enter" keys, they behave very differently in this context.
Also, if you would like to use the "Enter" key, you can add a forward slash to the end of the input and then press "Enter" which would return the same results as the "Return" key.
Silly me.