What is more efficient to pass as a parameter--a pointer or
an object? Why?

Answer Posted / amar

Passing a parameter by pointer is more efficient than
passing as object. When a parameter is passed as object
another of copy of the object is created on stack hence it
has two overheads, 1. it takes cpu cycle while creating
copy object 2. it takes memory on stack.

Passing the parameter through pointer could lead to a
situation where function can acciedently change the value
of the object.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where can I find microsoft visual c++?

650


In which Way invoke context-sensitive help inside the editor?

1858


What is visual c++ 2008 redistributable x64?

635


What is splitter window in vc++?

788


Can I uninstall visual c++?

675






Where can I find microsoft visual c++ on my computer?

683


What is microsoft visual c++ 2015 redistributable?

678


What is iunknown? Explain some of commonly used methods provided by iunknown.

706


What is visual c++ 2010 redistributable package x64?

632


How do I reinstall microsoft visual c++?

595


Do I need microsoft visual c++?

638


What is difference between c++ and vc++?

781


What is vcredist?

704


How do I get rid of microsoft visual c++ runtime library error?

758


How do I uninstall and reinstall microsoft visual c++ runtime libraries?

655