diff --git a/src/fork.c b/src/fork.c new file mode 100644 index 0000000..8735881 --- /dev/null +++ b/src/fork.c @@ -0,0 +1,15 @@ +#include +#include +#include + +int main () +{ + pid_t pid; + pid=fork(); + if (pid < 0) + printf("error in fork!"); + else if (pid == 0) + printf("i am the child process, my process id is %d\n",getpid()); + else + printf("i am the parent process, my process id is %d\n",getpid()); +}