Create a gist now

Instantly share code, notes, and snippets.

@shinkwhek /myforkex.c Secret
Created May 9, 2017

What would you like to do?
#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
int main (void) {
printf("1\n");
pid_t A = fork();
printf("fork():%d\n",A);
printf("pid:%d\n",getpid());
if(A==0)
printf("a\n");
else
printf("b\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment