1A (C) - Mycompiler
1A (C) - Mycompiler
1A
C ▶
1 #include<stdio.h>
2 #include <unistd.h>
3 #include<sys/types.h>
4 int main()
5 {
6 int id,childid;
7 id=getpid();
8 if((childid=fork())>0)
9 {
10 printf("\n I am in the parent process %d
11 printf("\n I am in the parent process %d
12 printf("\n I am in the parent process %d
13 }
14 else
15 printf("\n I am in child process %d",id)
16 printf("\n I am in the child process %d"
17 printf("\n I am in the child process %d"
18 }
Program input
Output
I am in child process 30
I am in the child process 31
I am in the child process 30
I am in the parent process 30
I am in the parent process 30
I am in the parent process 9
Comments
Supported languages
Deno JavaScript NodeJS
Python Ruby Go
C C++ Java
C# TypeScript PHP
Bash R Octave
(MATLAB)
Clojure D Perl
Assembly