0

What is the name of this loop and how compiler reads it?

https://code.sololearn.com/cyQsrRlfWx7W/?ref=app

27th Apr 2021, 2:44 AM
Mohammad Mehedi Hasan
Mohammad Mehedi Hasan - avatar
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
27th Apr 2021, 3:43 AM
XXX
XXX - avatar
0
https://code.sololearn.com/cN079m1i6ykX/?ref=app Am I right??
27th Apr 2021, 9:56 AM
Mohammad Mehedi Hasan
Mohammad Mehedi Hasan - avatar
- 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:
27th Apr 2021, 3:46 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar