C language goto label name statement

goto statements and labelname
syntax and use of goto and lanbelname
example of goto statement and labelname

goto statement and labelname

goto statement

goto is an unconditional construct it helps us to jump the control from one location to another location within the program. The location within the program is marked by a labelname.

Syntax:

goto labelname;

Example:

goto abc;
goto xyz;
goto Pqr;
goto a;

Labelname

label name helps to mark a location in the program, where the control can jump with the help of goto statement.

Syntax:

labelname:

Example:

abc:
xyz:
pqr:
a:
a1:

Note: label name can be anything, but should not be a keyword. Should follow the rules of an identifier.

 

goto label examples

C Language Programming Tutorial

C Language Tutorial Home     Introduction to C Language     Tokens     If Condition      goto statement and Labelname     Switch Statements     For loop     While Loop     Do while loop     break and continue     Functions     Recursion     Inbuild Functions     Storage Classes     Preprocessor     Arrays     Pointers     Structures and Unions     File Handling     Projects