title: C programming child process is not executing
body: <p>So this is simple program of creating two process: parent and child. So what I did is have the greeting inside the parent and the name inside the child process. For some reason my child process is not printing despite that I called wait() inside the parent. What should I do?</p>
  
  <p>GOAL OUTPUT: "Hello Sam"
  OUTPUT I"M GETTING: "Hello"</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;unistd.h&gt;
  
  int main()
  {
      char *greeting = "Hello";
      char *name;
  
  
      pid_t pid;
  
      pid = fork();
  
      if(pid == 0)
      {
        name = "Sam";
        exit(0);
      }
      else if(pid == -1)
          printf("Fail\n");
      else{
        wait(0);
       printf("%s %s", greeting, name);
    }
  
  } 
  </code></pre>