title: Updating pointers in a function
body: <p>I am passing a pointer a function that updates it. However when the function returns the pointer it returns to the value it had prior to the function call.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  static void func(char *pSrc) {
      int x;
      for ( x = 0; x &lt; 10; x++ ) {
          *pSrc++;
      }
  
      printf("Pointer Within Function: %p\n", pSrc  );
  }
  
  int main(void) {
  
      char *pSrc = "Good morning Dr. Chandra. This is Hal. I am ready for my first lesson.";
  
      printf("Pointer Value Before Function: %p\n", pSrc  );
  
      func(pSrc);
  
      printf("Pointer Value After Function: %p\n", pSrc  );
  
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>Here is the output</p>
  
  <pre><code>Pointer Value Before Function: 0x100403050
  Pointer Within Function: 0x10040305a
  Pointer Value After Function: 0x100403050
  </code></pre>
  
  <p>What I was expecting was the value after the function to match the one from within the function.</p>
  
  <p>I tried switching to <code>char **pSrc</code> but that did not have the desired affect.</p>
  
  <p>I am sure the answer is fairly simple, but I am a recovering hardware engineer and can't seem to figure it out :-)</p>