Pointers are essentially absolute. They are actually abstract as far as the language standard is concerned, so could conceivably be implemented in many ways. But for a standard PC these days, they are absolute values, essentially unsigned integers of 32 or 64 bits.
I don't understand how your code demonstrates anything at all. I think that you perhaps don't exactly understand what fork does. It creates an entirely separate process (with its own completely separate virtual memory address space, which I think is where your confusion lies). The initial value of the memory of the new process is a copy of the parent (with some minor differences such as the pid_t returned by fork).
Look at what your code is doing:
Code:
// Set parent to the pid of this process
pid_t parent = getpid();
// Allocate a small chunk of memory, storing its address in pid.
pid_t *pid = calloc(sizeof(pid_t), 1);
// Fork this process into two processes.
// The parent process will recieve the pid_t of the child.
// The child will receive 0, indicating that it is the child.
pid_t tmp = fork();
if (tmp != 0) { // if this is NOT the child
*pid = tmp; // store the returned (child) pid in *pid.
}
// Now both processes will print the contents of that memory location.
// Remember that they both have completely separate virtual memory spaces
// so that even though the virtual address is the same, the actual
// location in physical RAM is different.
// Only the parent will have actually stored a value in its location.
printf("%d\n", *pid);