- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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
Advertisements
To Continue Learning Please Login
Login with Google