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

What is the difference between turbo c++ and visual c++?

536


What is cmutex?

587


Do I need microsoft visual c++?

573


What is dao in vc ++?

547


Do I need ms visual c++ on my computer?

624






What is microsoft visual c++ used for?

563


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

672


What is ole? How do you handle drag and drop in ole?

555


What is visual c++ 2010 redistributable package x64?

546


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

603


What is cmutex? How can we use it?

575


What is microsoft visual c++ 2008 redistributable?

589


Does visual c++ 2017 replace 2015?

589


How do I uninstall vc++ 2015?

514


Explain the significance of initapplication() in vc++.

656