title: Passing and Assigning New Value to Pointer C++
body: <p>I'm passing a pointer to a function.  I'd like to assign a new address to the passed pointer inside the function, and I'd like that address to be used after the function returns.  I'm not sure if this is possible, but I'd like to do:</p>
  
  <pre><code>int main()
  {
      int i = 100, j = 200;
      int * intPtr = &amp;i;
      foo(intPtr, j);
      //  I want intPtr to point to j, which contains 200 after returning from foo.
  }
  
  void foo( int * fooPtr, int &amp; newInt )
  {
      int * newIntPtr = &amp;newInt;
      fooPtr = newIntPtr;
  }
  </code></pre>
  
  <p>Is this possible, or will <code>intPtr</code> not maintain the new assignment after returning from <code>foo</code>? Could this work (if it doesn't: why)? </p>