When trying to conserve memory usage, which method of parameter passing might be most effective in certain situations? 

  • Pass by value 
  • Pass by pointer 
  • Pass by array 
  • Pass by double reference
Passing by pointer often conserves memory because only the address of the variable (usually 4 or 8 bytes, depending on the architecture) is passed, regardless of the size of the actual data. While pass by value creates a copy of the actual data, which can consume more memory, especially for large objects or structs. Pass by reference behaves similarly to pass by pointer in this regard.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *