Q:

Infinite loops often arise in embedded systems. How do you code an infinite loop in C?

0

Infinite loops often arise in embedded systems. How do you code an infinite loop in C?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

In embedded systems, infinite loops are generally used. If I talked about a small program to control a led through the switch, in that scenario an infinite loop will be required if we are not going through the interrupt.

There are different ways to create an infinite loop, here I am mentioning some methods.

Method 1:

while(1)
{
// task
}

Method 2:

for(;;)
{
// task
}

Method 3:

Loop:
goto Loop;

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Embedded C interview questions and answers (2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to access the fixed memory location in embedde... >>
<< What are the start-up code steps?...