title: i am confused with the child process that I have to implement for each unix command in this program
body: <p>I just want implementation of child process for each unix command that I have created and need to printout each process id. It should be like for every individual unix command I have to make child process</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(int argc, char **argv)
  {
  
      if(argc == 1){
          printf(&quot;Pass UNIX commands as command line arguments to execute it.&quot;);
          exit(0);
      }
      
      int commandLen = ceil((argc - 1)/2) ;
      printf(&quot;Command length : %d&quot;, commandLen);
      pid_t pids[commandLen];
      
      for(int i=1; i&lt; argc ; i= i +2 ){
  
                if( i&lt; argc &amp;&amp; (i+1)&lt; argc){
                      char * command = (char *) malloc(2 + strlen(argv[i])+ strlen(argv[i+1]) );
                      strcpy(command, argv[i]);
                      strcat(command, &quot; &quot;);
                      strcat(command, argv[i+1]);
                      system(command);
                  }else{
                      system(argv[i]);
                  }
      }
      return 0;
  }
  </code></pre>