Consider the following code snippet.
if (fork() == 0)
{
a = a + 5;
printf("%d, %d \n", a, &a);
}
else
{
a = a - 5;
printf ("%d, %d \n", a,& a);
}
AFAIK, when fork () is executed, the parent's virtual address space is copied to the child, and both child and parent objects share the same physical pages until one of them tries to change. At the moment when one of the child and parent objects changes the variable, the physical page of the parent is copied to another page for the child, and the physical pages remain closed. So, here the meaning of “a” is different for the child and the parent. But when it comes to addresses "a" in the child and parent languages, the conclusion is the same. I cannot understand why the address remains the same even if the physical pages are different.