C goto keyword

  • It is a keyword, by using this keyword we can pass the control anywhere in the program within the local scope.
  • When we are working with the goto statement it required an identifier called label.
  • Any valid identifier followed by colon is called label.
  • Whenever we are working with goto statement it is called unstructured control flow statement because it breaks the rule of structure programming language.

Syntax:

statement1;
statement2;
statement3;
goto label;
statement4;
label:
statement5;
statement6;

Examples:

void main()
{
printf(“A”);
printf(“B”);
goto ABC;
printf(“Welcome to k2schools”);
ABC:
printf(“C”);
printf(“D”);

}

Powered by k2schools