title: c++ pointer type and call by reference
body: <p>I have a problem with pointer type when writing my program.
  The code looks like follows:</p>
  
  <pre><code>datatype B;
  int func(datatype* A){
   A=&amp;B;
  };
  int main(int argc,char** argv){
   dataType* mainA=new dataType;
   func(mainA);
  }
  </code></pre>
  
  <p>What I want is after excuting <code>func(mainA)</code>. <code>mainA</code> is point to B. I know my code is wrong, after that, mainA did not change. I thought this should like something called call by reference. Can anyone help me solve this problem?</p>
  
  <p>Many thanks.</p>