Ask coding questions

← Back to all posts
Clearing a screen in for the C language
Yuvikiit (7)

Hello everyone,
Actually I needed to clear the screen for my C code when re-executed.
I included the stdlib.h header and used system("cls") as it works in codeblock but seems that same doesn't work with Repl.
So please let me know how to do the same process here.
Happy Coding to All :)

Answered by SPQR (587) [earned 5 cycles]
View Answer
SPQR (587)

You can print "\033[0;0H\033[2J" to the console to clear it. This is an ANSI escape code. The \033[ tells the console that an escape sequence comes next. 0;0H resets the cursor position and 2J actually clears the screen.

Please mark this as the answer if I solved your problem :)

Yuvikiit (7)

For Helping Me Out