User Tools

Site Tools


cpp:control_structures:goto

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cpp:control_structures:goto [2024/02/16 01:04] (current)
Line 1: Line 1:
 +{{keywords>wiki library source code example reference}}
 +===== goto =====
 +    Syntax: 
 +    goto Jumppoint;
 +    
 +    Jumppoint: e.g. instruction function
 +===== cpp Sourcecode Example =====
 +<code cpp>
 +#include <iostream> /* including standard library */
 +
 +using namespace std;
 +int main( void ){
 +
 +int i;
 +
 +for (i=0;i<=99;i++) {
 +    if (i==42) {
 +        goto jump_point;
 +    }
 +}
 +
 +jump_point: cout << "Found the answer " << i << " ... is this right ?" << endl;
 +
 +return 0;
 +}
 +
 +</code>
 +
 +    output
 +    Found the answer 42 ... is this right ?
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
cpp/control_structures/goto.txt · Last modified: 2024/02/16 01:04 (external edit)

Impressum Datenschutz