In C both static local variable and static global variable with same name declaration are done in same file. They both are stored in data segment memory.
When I compile code why it is not throwing error?
In same memory 2 variable with same name can be stored?
Please find code below
#include <stdio.h>
static int x = 0;
void call()
{
printf("Adress of gloabl static =%p",&x);
}
int main()
{
static int x = 0;
printf("Adress of local static =%p",&x);
call();
}