Yeah you are fine as-is. I am not trying to keep you on your toes. Just trying to help you eliminate unnecessary lines of code.

I will give you a reader's digest explanation of strtol() as well as the link to a man page. If you are a linux guy you can just type man strtol on your bash shell as well.

The reason I would rather you use this function instead of atoi() is because it has an optional parameter (which I opted to utilize) to move the value of a pointer to where ever it stopped its parsing. In other words, it will move your string over to where ever your number is no longer a number, and point you to the white space. The reason I did this is because your previous code required input to be written like this:


In order to produce the results:

Now you can put numbers more like

51 32 *
12 37 -

The only problem to address now is that you cannot process decimals or negative numbers.