0
What is the name of this loop and how compiler reads it?
3 Respostas
+ 2
The syntax
```
label_name :
// code
```
Will make something known as a label with name 'label_name'. In short, a label is a location in the program. When you use 'goto label_name', the execution of the program will go to the line on which the label was defined.
In your code, when you use 'goto lbl' on line 10, the execution of the program goes back to where the label was defined, that is, line 5 and continues executing from line 6. Hence, you keep 'jumping' from line 10 to line 6 till i<5.
More on goto statements:
https://en.cppreference.com/w/cpp/language/goto
Why goto should be avoided:
http://david.tribble.com/text/goto.html
0
https://code.sololearn.com/cN079m1i6ykX/?ref=app
Am I right??
- 1
Mohammad Mehedi Hasan
goto is a jumping statement.
It jump one statement to another statement without any condition in a code.
Syntax 1:
goto LABEL:
<statements> // Forward jump
LABEL:
Syntax 2:
LABEL:
<statements> // Reverse jump
goto LABEL: