title: Fork and Execlp
body: <p>I trying a program with fork and execlp where parent address space is replaced with "ls" command.</p>
  
  <pre class="lang-c prettyprint-override"><code>#include&lt;stdio.h&gt;
  main()
  {
      int pid,j=10,fd;
      pid=fork();
      if(pid==0)
      {
          printf("\nI am the child\n");
          execlp("/bin/ls","ls",NULL);
          printf("\nStill I am the child\n");
  
      }
      else if (pid &gt; 0)
      {
          printf("\n I am the parent\n");
          wait();
      } 
  }
  </code></pre>
  
  <p>When I execute the program the last line of child</p>
  
  <pre><code>printf("\nStill I am the child\n");
  </code></pre>
  
  <p>is not printed. Why?</p>