Skip to main content

infinite loop in C


Infinite loop or endless loop in C


An infinite loop program is a thread that never ends stable in a "natural". Ending thread is exceptionally user or a break in software or hardware. Sample loops. The classic example for infinity.


infinite loop  using for loop:

#include "stdio.h"
 
int main () {

   for( ; ; ) {
      printf("This loop will run forever.\n");
   }

   return 0;
}



infinite loop  using do while loop:

   
#include "stdio.h"

int main ()
{
   do
   {
      printf("This loop will run forever.\n");
   }
   while(1);
   return 0;
}



infinite loop  using while loop:

#include "stdio.h"
 
int main ()
{
   while (1)
   {
      printf("This loop will run forever.\n");
   }
    return 0;
}

Comments

Popular posts from this blog

CAN INTERVIEW QUESTIONS

Qualifiers and Modifier in C

RTOS Real time operating system interview questions

CAN INTERVIEW QUESTIONS 2

What is UDS protocol

Memory mapping in c

TOP IOT PLATFORMS