#include #include #include #include int main() { void* address = mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0); if (address == MAP_FAILED) { perror("mmap"); return 1; } int* ptr = (int*)address; *ptr = 16; pid_t child = fork(); if (child < 0) { perror("fork"); return 1; } if (child == 0) { *ptr = 32; _exit(0); } waitpid(child, NULL, 0); printf("the value is %d\n", *ptr); return 0; }