Kizspy | Question: 10
(Choose 1 answer)
Given the following code snippet:
#include <stdio.h>//Line 1
void someFunction() { //Line 2
int localVar = 10;
//Line 3
printf("%d ", localVar);//Line 4
} main() { int
//Line 5
//Line 6
//Line 7
someFunction();
", localVar); //Line 8
printf("%d return 0;
//Line 9
//Line 10
What happens when attempting to access a local variable outside its scope in C?
A. The program will cause a compilation error at line 8
B. The program crashes at runtime due to an undefined variable.
C. The variable's value becomes zero when accessed outside its scope.
D. The program displays the variable's last value even outside its scope.