title: Does fork() create a duplicate instance of all the variables and object created by the parent process for the child process?
body: <p>Suppose I have a main process running and in its execution it has initialized some pointers and created some instances of a predefined structure.</p>
  
  <p>Now if I fork this main process, is seperate memory allocated for the pointers?And are duplicate instances of the previously existing variables, data structures created for this new process?</p>
  
  <p>As an example of my requirement consider -</p>
  
  <pre><code>struct CKT
  {
    ...
  }
  
  main()
  {
     ...Some computations with the structure and other pointers.....
     pid_t pid = fork();
     if(pid == 0) //child
     {
         ..some more computations with the structure...but I need a 
         ..separate instance of it with all the pointers in it as well..
     }
     else if(pid &gt; 0) // parent
     {
         ..working with the original instance of the structure..
     }
     // merging the child process with the parent...
     // after reading the data of the child processes structure's data... 
     // and considering a few cases...
  }
  </code></pre>
  
  <p>Can anyone explain how do I achieve this??</p>