title: Fork function with 2 integers
body: <p>I am trying to understand how the fork() function works for my class of operating systems.</p>
  <p><a href="https://i.stack.imgur.com/nPUqB.png" rel="nofollow noreferrer">enter image description here</a></p>
  <pre><code>int main(int argc, char *argv[])
  {
      int i, height, width;
      if (argc!= 3) exit(0);
      height = atoi(argv[1]); /* height */
      width = atoi(argv[2]); /* width */   
      pid_t t;
      
  for(i=0;i&lt;height;i++){
  t=fork();
  for(int j=0;j&lt;width;j++){
  if(j==width-1){
  if(t!=0){
        break;
        }
  //break;
  } else if (t==0){
  //continue;
  }}}
      printf(&quot;I´m father %d and my child is %d\n&quot;, getppid(), getpid());
      sleep(1);
      return 0;
  }
  </code></pre>
  <p>this is what I get when height=4 and width=3.</p>
  <pre><code>I am the father  3182 y mi hijo es 3184 and my t value = 3190
  I am the father  3180 and my child is 3181 and my t value = 3191
  I am the father  2008 and my child is 3180 and my t value = 3186
  I am the father  3180 and my child is 3182 and my t value = 3187
  I am the father  3181 and my child is 3188 and my t value = 3192
  I am the father  3180 and my child is 3183 and my t value = 3189
  I am the father  3181 and my child is 3185 and my t value = 3194
  I am the father  3185 and my child is 3193 and my t value = 3195
  I am the father  3180 and my child is 3182 and my t value = 3187
  I am the father  3180 and my child is 3181 and my t value = 3191
  I am the father  2008 and my child is 3180 and my t value = 3186
  I am the father  3181 and my child is 3185 and my t value = 3194
  I am the father  2008 and my child is 3180 and my t value = 3186
  I am the father  3180 and my child is 3181 and my t value = 3191
  I am the father  2008 and my child is 3180 and my t value = 3186
  
  </code></pre>
  <p>The online course teacher published a message with a hint that I tried to follow, “The case is that the tree will go down x=height levels starting from the initial process, and the first child of each level will have y=width children, except in the last level where there will be (witdh -1) children”
  I am 100% sure that there must be 2 for loops, an outer loop for height and an inner loop for width. All the children come out of the two loops and terminate after being created, except the last one, i.e. when j == width - 1, which continues with another repetition of the outer loop (height). Not having any guidance and clue is something.
  Thanks.</p>
  <p>I am very rookie in terms of the use of fork so if anyone could help me to un
  Thanks in advance.</p>