title: Data between pointers
body: <p>If the following is being done, will the actual data in the pointer be copied or the pointer itself?</p>
  
  <pre><code>void nav_runGpsSystem(GPSLocation *dest)
  {   
      GPSLocation *destination = malloc(sizeof(GPSLocation));
      destination = dest;
  </code></pre>
  
  <p>Where GPSLocation is the following</p>
  
  <pre><code>typedef struct
  {
      double latitude;
      double longitude;
  }
  GPSLocation;
  </code></pre>
  
  <p>The issue is the <code>GPSLocation</code> that is being created, the pointer, is created outside of the subsystem that uses it, but its still on the same board(pandaboard running ubuntu netbook edition). I dont want data to be lost of pointers to get damaged somehow, so I want to copy the data that the first pointer was pointing to so that the system that created it can free the pointer when they want to.</p>
  
  <p>EDIT</p>
  
  <p>After reading the answers it is clear I must dereference using 
  <code>*destination = *dest</code></p>
  
  <p>So what if I then want to pass the data to threads</p>
  
  <p>as so </p>
  
  <pre><code>void *startgpswatchdog(void *ptr)
  {
      GPSLocation *destination;
      destination = (GPSLocation *) ptr;
  </code></pre>
  
  <p>If I have the data copied into my system now, is there a need to copy the data again inside a pthread or is passing just the pointer enough as it is already malloced and the threads share the same memory space?</p>