View difference between Paste ID: jnN310nL and i4MVXd6L
SHOW: | | - or go back to the newest paste.
1
#include <stdio.h>
2
#include <stdlib.h>
3
4
int main(int argc, char* argv[]){
5
	int i, pid;
6
	printf("I am the parent! my pid = %d\n",getpid());
7
	for(i=1; i<11; i++){
8
		pid = fork();
9
		if(pid !=0)
10
			wait();
11
		else{
12
			printf("I'm a child!!, Child number = %d, my pid = %d\n",i ,getpid());
13
			exit(0);
14
		}
15
	}
16
	return 0;	
17
}