goto statement in a c programming is used to jump the execution of a program to any other place in program.Let us see example to understand it properly.
Example:
#include<stdio.h>
#include<conio.h>
main()
{
int a=1;
clrscr();
while(a<=10)
{
print:
printf("%d,",a);
a++;
if(a==6)
{
a++;
goto print;
}
}
getch();
}
Example:
#include<stdio.h>
#include<conio.h>
main()
{
int a=1;
clrscr();
while(a<=10)
{
print:
printf("%d,",a);
a++;
if(a==6)
{
a++;
goto print;
}
}
getch();
}