So this piece of program compiles and runs fine. but i don't understand why it is printing out 41. Since the variables are not global. They are local to the function.
For the sake of clarification i am changing the variable names in two different method. the name of variable being same has nothing to do with the result.
#include<stdio.h>
void init();
void _print();
int main(){
init();
_print();
}
void init(){
int myVar;
myVar = 41;
}
void _print(){
int xyz;
printf("%d",xyz);
}