Clear Terminal in C

I am facing problem to understand this line of code.

printf("\033[2J\033[1;1H");

This printf statement is used to clear the terminal in c. Can anybody explain this to me?

Thanks.

3

1 Answer

Take a look at the list of ANSI escape sequences:

ESC[2J : erases the entire screen

General information:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest