Function scope
From cppreference.com
Function scope starts with the opening brace ({) of a function and ends with the closing brace (}) of that function.
A label name is the only kind of identifier that has function scope. Using a label name may occur (in a goto statement) anywhere in the function in which the label name appears. The syntactic appearance of a label name, that is a name followed by a colon (:) and a statement, implicitly declares the label name.
So, a label is visible throughout the function in which the label's declaration resides. A goto statement which targets a label must be in the same function as the label's declaration. The goto statement may appear before or after the label that it targets.
[edit] Example
Labels and goto's perform a while loop.
Run this code
#include <stdio.h> int main(void) { /* start of a function scope */ /* Simulate "while (i<5) { ... }". */ int i = 0; top_of_loop: if (!(i<5)) goto label_3; /* goto appears before label declaration */ printf("i = %d\n", i); ++i; goto top_of_loop; /* goto appears after label declaration */ label_3: return 0; } /* end of a function scope */ /* end of this translation unit, end of file scope */
Possible output:
i = 0 i = 1 i = 2 i = 3 i = 4