Pages

Wednesday, 9 May 2018

goto statement in C



goto statement in CBy using goto statement you can transfer the control of program anywhere. This keyword is not recommended to use in any situation.


Syntax


goto label;
. . . .
. . . .
label: statement;
Flowchart of goto statement in C
#include<stdio.h>

void main()
{
 int i=1;

 if(i==1)
  goto one;
 else if(i==2)
  printf("2");
 else
  printf("Its nothing");

 one:
 printf("Avoid goto keyword");
}