Computer Science, asked by deekshitha44, 9 months ago

Demonstration the working of goto statements​

Answers

Answered by atiya12
1

The goto statement is rarely used because it makes program confusing, less readable and complex. Also, when this is used, the control of the program won’t be easy to trace, hence it makes testing and debugging difficult.

C – goto statement

When a goto statement is encountered in a C program, the control jumps directly to the label mentioned in the goto statement.

Explanation:

In this example, we have a label addition and when the value of i (inside loop) is equal to 5 then we are jumping to this label using goto. This is reason the sum is displaying the sum of numbers till 5 even though the loop is set to run from 0 to 10.

Similar questions