Register now or log in to join your professional community.
By using main we can able to implement infinite loop as i shown below..
#include<stdio.h>
void main()
{
printf("Hello");
main();
}
by using recursion functions we can implement infinite loop
main()
{
abc :
if(condition)
goto bcd:
statements;
goto abc;
bcd:
}
Above sample code will give you control over infinite loop without using looping statements.
#include<stdio>
using namespace std;
void main()
{
cout<<"~";
main();
}
//that will print "~" infinitly, another way is by making a false condition recursion.
#include<stdio.h>
void main()
{
main();
}
#include<stdio.h>
void main()
{
LL:
printf("hello world");
goto LL;
}
#include<stdio.h>
void main()
{
printf("hello world");
main();
}
Output: Infinite time it will print "hello world" on the screen.