daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Oct 22nd, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <unistd.h>
  4.  
  5. int main() {
  6.     puts("initializing");
  7.     int a = 5, *p = &a, pid;
  8.  
  9.     printf("dad pid: %d\n", getpid());
  10.     pid = fork();
  11.     if(!pid) {
  12.         *p = 3;
  13.  
  14.     } else {
  15.         sleep(1);
  16.         printf("dad_a %d\n", a);
  17.     }
  18.  
  19.     printf("a from %d: %d\n",getpid(), a);
  20.     printf("a_ reference %i\n", p);
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top