+ 1
Why we use pointers in c++?
5 Answers
+ 3
Ciro Pellegrino
13 years of experience as an android developer? But first release of android device was on 23 September 2008 means 12 years ago. He must be super master of android development.
I think he is 13 years old not 13 years of experience.
+ 1
Thanks everyone
0
to an Android programmer with 13 years of experience I can only answer that it is done to have a greater chance of introducing bugs in the code. đ¤Ł
0
One of the usages of pointer is that :
When you pass a variable to another function and you do some expressions on it and you come back to main function and want to print this variable , it will give you the last value that variable has in main function.
For example :
#include <iostream>
void s(int n )
{n *=5;}
int main()
{
int n = 67;
s ( n ) ;
std::cout << n;// output is 67
}
#include <iostream>
void s(int &n )
{n *=5;}
int main()
{
int n = 67;
s ( n ) ;
std::cout << n;//output is 67 * 5
}