title: Call by reference vs Pointer argument
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c"><strong>FAQ</strong>: How to pass objects to functions in C++?</a><br>
    <a href="https://stackoverflow.com/questions/114180/pointer-vs-reference">Pointer vs. Reference</a>  </p>
  </blockquote>
  
  
  
  <p>Hi all,<br>
  in c/c++,
  we can pass a object as call by reference or passing pointer of the object.<br>
  for example:<br>
  i want to create a function which will take string vector as input and output a map that contains some value for each string. the return value of the function is bool, which indicate success or failure.</p>
  
  <p><b>function (call by reference)</b><br/></p>
  
  <pre>
  bool calculateSomeValue( vector&lt;string&gt; input, map&lt;string, double&gt;& result)
  {
  //// bla bla bla
  return true/false;
  }
  </pre>
  
  <p><b>function (using pointer )</b></p>
  
  <pre>
  bool calculateSomeValue( vector&lt;string&gt; input, map&lt;string, double&gt;* result)
  {
  //// bla bla bla
  return true/false;
  }
  </pre>
  
  <p>which one is best? does any one have any idea of the pros and cons of these two options?</p>
  
  <p>thanks in advance.</p>