All articles
c

A program to explain GOTO

Share this article

Share on LinkedIn Share on X (formerly Twitter)

C Programming Language 048

The following code shows how to write a program to explain GOTO.

Program

#include <stdio.h>
 
void main()
{
    printf("Hi\n");
    printf("Good morning\n");
 
    goto abc;
    printf("Have a nice day\n");
 
abc:
    printf("End\n");
}

Result

Hi
Good morning
End

Comments