Explain the working of go to statement in C programming

04 b] Explain the working of go to statement in C programming.

Answer:-

goto is an unconditional branching statement

Syntax:-

goto label;
statement1;
statement2;
label:
forward jump
backward jump

➢ A label is a valid variable name.
➢ Label need not be declared and must be followed by a colon.
➢ Label should be used along with a statement to which control is transferred.
➢ Label can be anywhere in the program either before or after the goto label.
➢ Here control jumps to label skipping statement1 and statement2 without verifying any condition that is the reason we call it an unconditional jumping statement.

Example:-

goto statement example

Leave a Reply

Your email address will not be published. Required fields are marked *