Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <stdio.h>
  3.  
  4. int main() {
  5.     char * foo = "Hello";
  6.     printf("foo = %p\n", foo);
  7.     int id = fork();
  8.     if(id == 0) {
  9.         /* child */
  10.         printf("I'm the child (foo = %p)\n", foo);
  11.     }
  12.     else {
  13.         printf("I'm the parent (foo = %p)\n", foo);
  14.         foo = "Ahoy";
  15.         printf("I'm the parent (foo = %p)\n", foo);
  16.         wait(id);
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement