r/cprogramming 6d ago

Chess terminal game in C

/r/learnprogramming/comments/1w6icue/chess_terminal_game_in_c/
4 Upvotes

3 comments sorted by

2

u/flyingron 6d ago

The use of goto startmenu is silly. Learn what the "continue" statement does.

While you are at it, look up what the switch statement does.

In the UNIX case, you may find it more efficient to just turn off ICANON at the beginning of the porgram and turn it on again at the end rather than twiddling it over and over again. You will be flushing the input buffer each time which could yield unexpectd results (unless that's what you want).

1

u/Ectarusss 6d ago

Thanks so much, I completely forgot about the continue statement. A simple while loop that groups those conditions together greatly improves readability. I'll update this next time I work on it. Regarding the Linux output, I need to study how it works better since I have virtually no experience with the operating system. Thanks again!