Breaking of infinite loop in turbo c

32 Views Asked by At

Whenever I forget to increment 'j' and hit run it becomes an infinite loop so what can we do to break the infinite loop in turbo c if I don't have the option of 'Break' on my keyboard?

what process we can follow in that scenario to break the running infinite loop in turbo c ?

2

There are 2 best solutions below

2
Raky On

Haha, You have to face it. The only way out is

  1. Teach your fingers to keep clicking Ctrl + S every now and then so that your code is saved, progressively.

  2. When Struck in infinite loop, the only ways getting out are:- a. Terminating Turbo C++ application directly. b. Terminating Turbo C++ application from Task Manager.

    d. Pressing Ctrl + C or Ctrl + Z continuously may sometimes help, but not gauranteed.

  3. Always, have an if block in a loop as a last statement to remind you that you need to check for condition before continuing the loop. You may also consider using for loop instead when you are sure at what point you need to teminate the loop and progress further.

1
Ezio Le On

Most of the laptops now a days don't have an explicit break key …but it doesn't mean that they don't have that function either.

So first thing you should find out that what key (or combination) has the function of break for your laptop and then you can try the same old way of terminating the loop …eg. ctrl+fn+f11

If that doesn't work then try to close the whole application with alt+f4 ….and in the worst case you just have to shut the machine off.

Advice …try to avoid turbo c ….( man this is 2024 ) ….it still supports some weird things. Try code::blocks …it is available on most of the desktop operating systems ;)

Best of luck