Published in: C++
URL: http://src.wtgstudio.com/?EoG1Ah
#include <stdio.h> void printn(int n, pid_t pid) { int c; for (c = 0; c < n; c++) if (pid) printf("parent: %d\n", c); else printf("child: %2d\n", c); } int main(void) { pid_t pid; pid = fork(); printn(5, pid); return 0; }
You need to login to post a comment.
