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



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

Answer / 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

More VC++ AllOther Interview Questions

Is it ok to uninstall microsoft visual c++?

0 Answers  


What is vcruntime?

0 Answers  


What is the value of the expression a = 42?

2 Answers  


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

0 Answers  


#include<stdio.h>int(){int a,*b,**c,***d,****e; a=10;b=&a;c=&b;d=&c;e=&c;printf("a=%d b=%u c=%u d=% e=%u",a,b,c,d,e);printf ("%d%d%d\n",a,a+?*b,**c+***d+,****e);return0;}

1 Answers  






How do I remove microsoft visual c++ 2015 redistributable?

0 Answers  


What keyboard editor command is used for Undo?

1 Answers  


What is the use of DDV and DDX routines ?

4 Answers   TCS,


Explain the advantages of cwinthread class.

0 Answers  


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

0 Answers  


Difference between critical section, mutex and semaphore.

0 Answers  


What is dao in vc ++?

0 Answers  


Categories