Same memory address for different processes
问题 I just can't figure out why this code works the way it does (rather than I'd expect): #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> #include <sys/types.h> int main() { int buffer; int* address; address=&buffer; if(fork()==0) { *address=27; printf("Address %ld stores %d\n",(long)address,*address); exit(0); } wait(NULL); printf("Address %ld stores %d\n",(long)(&buffer),buffer); return 0; } Why does the system store different variables even if they're pointed