I got some problems writing my snake game program. I need to make game working on linux and windows. I found some topics how to clear screen on linux and windows using the
On Unix-liked systems including Linux and macOS, you can use ncurses library (POSIX API). In case of Windows (or even Linux or macOS), the following code will work on ANSI terminals on any systems.
printf("\033[2J\033[H");
/* or */
printf("\033[0;0f");