Create Child Process Using Fork() System Call And Print The Parent ID In Child process And Child ID In Parent Process.
C program to create child process using fork() system call. Print the parent ID in child process and child ID in parent process. Source Code: #include<stdio.h> #include<stdlib.h> #include<time.h> void main() { int pid; pid=fork(); if(pid == 0) printf("\nParent id: %d from child",getppid()); else printf("\nChild id: %d from parent",pid); }
0 comments