- C Programming Basics
- C Tutorial
- C Program Structure
- C Basic Syntax
- C Data Types
- C Constants
- C Variables
- C Operators
- C Ternary Operator
- C Storage Classes
- C Flow of Control
- C Decision Making
- C if if-else Statement
- C switch Statement
- C Loops
- C for Loop
- C while Loop
- C do-while Loop
- C goto Statement
- C break Statement
- C continue Statement
- C Popular Topics
- C Arrays
- C Strings
- C Pointers
- C Functions
- C Recursion
- C Scope Rules
- C Programming Advance
- C Structures
- C Unions
- C Bit Fields
- C Enumerations
- C Input & Output
- C Typedef
- C Preprocessors
- C Type Casting
- C Recursion
- C Error Handling
- C Linked Lists
- C Stacks
- C Queues
- C Binary Trees
- C Header Files
- C File I/O
- C Variable Arguments
- C Memory Management
- C Command Line Arguments
- C Programming Examples
- C Programming Examples
- C Programming Test
- C Programming Test
C goto Statement
In C language, the goto statement requires a label (a label is a valid identifier followed by a colon) for operation. Furthermore, the label must be in the same function as the goto that uses it, you can't jump between functions.
Here is the general form of the goto statement in C programming:
label: . . . goto label;
Here label is any valid label either before or after goto. Let's go through the following example program.
C goto Statement Example
Here is an example program that uses the goto statement in C programming to illustrate it:
/* C goto Statement Example * This program illustrates the * concept of goto statement in C */ #include<stdio.h> #include<conio.h> void main() { int i = 1; int num = 2; clrscr(); tab: printf("%d * %d = %d\n", num, i, num*i); i++; if(i<=10) goto tab; getch(); }
This program prints the table of 2. Here is the sample run of the above C program.

« Previous Tutorial Next Tutorial »
Follow/Like Us on Facebook
Subscribe Us on YouTube