There is nothing fundamentally wrong, except bad code formatting, so the boundaries of cases are not well readable.
However, potentially it can be wrong; and something can be fixed right away.
Sure, the program terminates when you press the symbol. This is just because you programmed it this way. I don't even want to address this "problem", because this is not a problem. Cycle you code, or do anything else you want. Essentially, add some code which should do what you want.
First of all, hard-coded '-' and '+'. What if you want to change these "keys" or change the set of them? Then hard-coding of those
immediate constants would make code unsupportable. The rule of thumb is: if you use some immediate constant in two or more place, it should be not there, because the change would require going in two places, which is a nasty kind of work and a sure source of bugs. You should explicitly declare such constants.
Another problem is only potential one. What if your switch statement becomes long, like one of those long handlers of Windows messages? This would be a problem of both readability and maintenance. In such cases, this is a sign the refactoring of code would be required. You could have some container of key-value pairs, where the value could be an action, that is, function reference, with separate functions describing each action. I can show you one approach, but this is
just to show an idea, as the code is unrelated to C; this is my article
Dynamic Method Dispatcher (
Attention: not C!).
Something similar could be implemented in C as well. Some said: it makes no sense, because the optimization step of the compiler will itself create a table of key-action pairs with fast search of the action by a key. That may be true, but I don't talk about optimization here (for something happening on the key press, extra millisecond just don't count; no one will notice the extra delay). I am talking about readability and maintainability.
—SA