hello everyone
In my C++ program I have to use fork() a number of times that the program takes as an argument in the command line,let's say I have to use fork() k times.
How am I supposed to refer to the children processes?
I mean when I have only one child I do:
Now that I have k children ,for the fork I do:Code:int pid=fork(); if(pid==0){ //child code }
but what about the if statement?Code:int pid[k] for(i=0;i<k;i++) pid[i]=fork();