Let's input a large expression, something like one with ten zeros. The program works, but not exactly as the user would expect. It first prints the incorrect result, then exits. But that's not our biggest problem. A program that quietly returns incorrect results is much worse than the one that crashes.
Incorrect information is worse than no information at all.
We have to fix it immediately. I increased the size of the buffer by one, so that I could grab one character more than the self-imposed limit. Now I can detect if my greedy request was satisfied and, if so, I know that the input was larger than maxBuf and I bail out. Before we try that, we have to increase maxSymbols , so that we can enter a few test symbol into our program. What we discover is that, although the program works, it quietly lies to the user.