

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
goto statement in C/C++
The goto statement is a jump statement. Within a function, it is used to jump from one statement to another. The use of this statement is highly discouraged. It makes the program complex and difficult to trace the control flow of program. It makes hard to modify the program.
Here is the syntax of goto statement in C language,
goto label; . . . label: statement;
Here is an example of goto statement in C language,
Example
#include <stdio.h> int main () { int a = 10; LOOP:do { if( a == 12) { a = a + 1; goto LOOP; } printf("Value of a: %d\n", a); a++; }while( a < 15 ); return 0; }
Output
Value of a: 10 value of a: 11 value of a: 13 value of a: 14
- Related Questions & Answers
- PHP goto Statement
- C program to explain the goto statement
- How can I use goto statement in JavaScript?
- Why doesn't JavaScript have a goto statement?
- Is there a goto statement available in bash on Linux?
- Example of goto in C or C++
- Goto in Arduino
- Continue Statement in C/C++
- Break Statement in C/C++
- Print a character n times without using loop, recursion or goto in C++
- Continue Statement in C/C++ Programming
- Switch case statement in C
- What is finally statement in C#?
- Explain switch statement in C language
- return statement vs exit() in main() C++
Advertisements