51.0k views
5 votes
This type of variable is defined inside a function and is not accessible outside the function.

A) global
B) reference
C) local
D) counter
E) None of these

1 Answer

6 votes

Final answer:

A local variable is defined within a function and can't be accessed outside of it. They have a local scope and are destroyed after the function's execution ends.

Step-by-step explanation:

The type of variable defined inside a function and not accessible outside the function is known as a local variable. Local variables are only recognized within the function they are declared in, which means that they have local scope. As soon as the function finishes executing, these variables are destroyed and can no longer be accessed. They are different from global variables, which are defined outside of any function and can be accessed from any part of the program.

User Darren Lau
by
7.2k points