Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I terminate an infinite loop in Turbo C?

I get stuck in an infinite loop. How can I terminate this loop? I tried to use/press Cntrlc but nothing happens. I don't know how to stop it.

main()
{
     while (1)
     {
          char ch;
          printf("Enter a character: \n");
          ch = getche();
          printf("\nThe code for %c is %d.\n", ch, ch);
     }
}
like image 391
Aaron Avatar asked Feb 24 '23 04:02

Aaron


1 Answers

CTRLBREAK will probably work for this. I have a vague recollection that CTRLC did not always work with the Borland products.

Though, that was a long time ago so I had to retrieve that from very deep memory, which may have faded somewhat :-)


My question for you is: Why is anyone still using Turbo C when much better and equally cheap solutions are available? Like gcc (such as in Code::Blocks) or even Microsoft Visual C Express.

like image 152
paxdiablo Avatar answered Mar 03 '23 05:03

paxdiablo