Practice mode C Language

In C, where must the label named in a goto statement be located?

Correct answer A. Anywhere in the same function as the goto

Explanation

Labels have function scope in C: a label can be the target of any goto in the same function, before or after it, but never in a different function. It need not be in the same block, which is why goto is sometimes used to jump to shared clean-up code at the end of a function. Jumping into the scope of a variable-length array is not allowed.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

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

Links and website addresses are not allowed in comments.