diff --git a/forking/simple.c b/forking/simple.c index 01328ac..7cbe148 100644 --- a/forking/simple.c +++ b/forking/simple.c @@ -13,15 +13,13 @@ int main() { memcpy(shmem, parent_message, sizeof(parent_message)); int pid = fork(); - if (pid == 0) { - printf("Child read: %s\n", (char*)shmem); - memcpy(shmem, child_message, sizeof(child_message)); - printf("Child wrote: %s\n", (char*)shmem); - + printf("Child read: %s\n", (char*)shmem); + memcpy(shmem, child_message, sizeof(child_message)); + printf("Child wrote: %s\n", (char*)shmem); } else { - printf("Parent read: %s\n", (char*)shmem); - sleep(1); - printf("After 1s, parent read: %s\n", (char*)shmem); + printf("Parent read: %s\n", (char*)shmem); + sleep(1); + printf("After 1s, parent read: %s\n", (char*)shmem); } }