Why in C++ passing a pointer is not termed as a parameter passing technique.....Is it because it has a flaw of some kind i.e. address is not reflected back/we can change the address in called function..is that so...if that's the reason....then we can pass it as const pointer as a remedy.....
I'm confused as to what you're asking. Post some code and/or clarify your question.
Passing pointers to (I assume) functions is valid C++. Take the following:
That will say that x is four at the end of the program. The same could be accomplished with references as well.
void inctwice(int *y)
*y += 2;
int x = 2;
std::cout << "Value of x: " << x << std::endl;
What i mean is why is it not considered as a parameter passing technique in C++
It is considered as a parameter passing technique in C++.
References are often preferred because you don't need to check for null (since pointers can legally be null), and because the syntax of a reference is more natural.
Maybe for most purposes references provide a safer and cleaner way of achieving the same effect as pointers.