Browsing articles tagged with " pointer"

Reference vs. pointer parameters in C++

Mar 2, 2012   //   by Ray Mitchell   //   Blog  //  No Comments

Reference and Pointer Parameters

A question that often arises when working with C++ is whether it’s better to use references or pointers for function parameters.  Both types of parameters provide the ability for a function to indirectly access an object in the calling environment.  This indirect access provides several benefits:

  1. The object referred/pointed to by the argument does not need to be copied in order for the function to have access to that object’s value
  2. The function can directly modify the object referred/pointed to by the argument
  3. The function can take parameters of types that do not allow copying

Read more >>

Recent Posts