title: C++ Passing Pointer to Function (Howto) + C++ Pointer Manipulation
body: <p>I am a little confused as to how passing pointers works.</p>
  
  <p>Let's say I have the following function and pointer, and... </p>
  
  <p><strong>EDIT</strong>: </p>
  
  <p>...I want to use a pointer to some object as an argument in the function.</p>
  
  <p>i.e.:</p>
  
  <pre><code>void Fun(int Pointer){
      int Fun_Ptr = ---Passed Pointer---; 
      //So that Fun_Ptr points to whatever ---Passed Pointer points to
  </code></pre>
  
  <p>Between the *Pointer and &amp;Pointer notations, I am very confused. I know that *Pointer means give whatever it points to.</p>
  
  <p>Do I put void (int *pointer) in the declaration. What about when I use the function?</p>
  
  <p>Your assistance is appreciated.</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Okay, I now understand that using *variable in a declaration means that a pointer will be passed. However, what about when i use the function?</p>
  
  <p>i.e.</p>
  
  <pre><code>int main(){
      int foo;
      int *bar;
      bar = foo;
      Fun(bar);
  }
  </code></pre>
  
  <p><strong>EDIT 3:</strong>
  Okay, so correct me if I am wrong:</p>
  
  <p>According to the conventions of the above code:</p>
  
  <p>bar = &amp;foo means: Make bar point to foo in memory</p>
  
  <p>*bar = foo means Change the value that bar points to to equal whatever foo equals</p>
  
  <p>If I have a second pointer (int *oof), then:</p>
  
  <p>bar = oof means: bar points to the oof pointer</p>
  
  <p>bar = *oof means: bar points to the value that oof points to, but not to the oof pointer itself</p>
  
  <p>*bar = *oof means: change the value that bar points to to the value that oof points to</p>
  
  <p>&amp;bar = &amp;oof means: change the memory address that bar points to be the same as the memory address that oof points to</p>
  
  <p>Do I have this right?</p>
  
  <p>EDIT 4: Thanks so much for all your help (I wish I could accept more than 1 answer, but I have to go with the first one. I am not sure how a community wiki works exactly, but I will leave it this way for editing (feel free to turn it into a ref guide if you like).</p>