Dear CProgramming.com administrator/s and members,

A greeting of peace.

I hope everyone is in good health upon reading this thread. Well, I have this code to "implement" an infinite loop:

Code:
#include<stdio.h>
int main(void){
     clrscr();
     do {
         printf(" C programming ");
     } while( getch() != 0 );
     
     return 0;

}


I want to stop this "possibly" infinite loop by means of pressing any key, but unfortunately, the string C programming will only keep on appearing if I keep on pressing any key, which is not I wanted. I want to stop the displaying of text if I press any key. On a tutorial, getch() function said:

gets character from console, no echoing.


I really don't know if getch() is the one right for the job. I hope someone could correct me what is the best thing to do.


Thank you very much and God bless everyone.

Warm regards,

Mark Squall