If we have a variable "x" which is defined globally and another variable with the same name "x" inside a function. when we print the value of "x" why we always get the value which is assigned inside the function? Is there any way we can print the global variable value.
int x=8;
void testCode()
{
int x=2;
printf("%d",x); //prints 2
}