New course! Every coder should learn Generative AI!
Try a free lesson0
When the global and the local variable have the same name :
1. Local variable is taken in the local scope where it is defined.
2. Outside the local scope the global is used.
So if we have
#include<stdio.h>
int x = 5;
int main(){
int x = 10;
printf("x is : ",x);
return 0;
}
// This code here prints 10