C Goto


In C language jump statement is called as goto statement.


The label is an identifier in syntax. When goto statement is occurred, control of the program jumps to label: and starts executing the code.

Goto Statements

Syntax:-

goto label;
……;
    
label:
statement;

Example:-

#include<stdio.h>   
void main(){  
    int i=0;  
    for(i=1;i<=5;i++){   
        goto num;
    }  
    num:
    printf("Goto Onlinetpoint");   
}

notepad
It is highly discouraged because it makes difficult to trace the control flow of the program and making hard to understand and modify. If any program uses the goto can be rewritten so that it does not need the goto.



OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.