C goto Statement

You are Here:

C goto Statement

The goto statement passes control anywhere in the program without least care for any condition.

This statement does not require any condition.


goto label; // user-defined code // return }

Example Program

In the below example program, We will use goto statement to display whether the given number is even or odd.

C Compiler
#include <stdio.h> int main() { int num = 27; if (num % 2 == 0) goto even; else goto odd; even: printf("%d is even", num); return; odd: printf("%d is odd", num); return; return 0; }


27 is odd

Congratulation! you have learned everything about goto statement in C Programming.


Hi Developers, we almost covered 98% of String functions and Interview Question on C with examples for quick and easy learning.

We are working to cover every Single Concept in C.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author