function-local variable

noun
UK /ˈfʌŋkʃən ˈləʊkəl ˈveəriəbl/
US /ˈfʌŋkʃən ˈloʊkəl ˈveriəbl/

A variable that only works inside one function.

The counter is a function-local variable, so other functions cannot see it.


OTHER MEANINGS

2. A variable declared inside a function whose lifetime ends when the function returns.

Each call creates a fresh function-local variable on the stack.

3. A name that shadows a global variable of the same name within a function body.

Inside the function, the function-local variable hides the global one.

4. A variable that cannot be accessed from outside its defining function.

Trying to read the function-local variable outside the function throws an error.