Computer Science for IGCSE & O level - Programming (Section 1 - No. 9)

What will happen if you try to access a local variable outside of its scope?
The program will print the variable's value.
The program will generate an error.
The program will automatically assign a default value.
The program will ask the user to input the value.

Explanation

Local variables' accessibility is limited, so attempting to use them outside of the scope will cause an error.

Comments (0)

Advertisement