+ 1
I don't understand why we use " & " in the code
7 Respostas
+ 3
"&" stores the memory address
int cont = 14;
int *d;
d = &cont;
int d* declares the pointer d
d = &cont; stores the memory address of cont in *d
cout << *d << endl;
prints 14
+ 1
& - refer to the address of the pointer.
int *p=5
cout<<&p;
this &p will be refers to the memory address of the pointer where the value is stored.
+ 1
Every variable have an address, & is used to get the address of that variable
int x
x is variable to get the address of x, we use &
like &x
0
Thats call buly reference
0
thank you, greatly appreciated
0
& is used to refer to an address of a pointer as said by others.
But also it is used in call by reference in functions as in,
func(int&x){}
here your argument say a is defined as int and den assigned as a=x.
so if value of x changes then that of a changes as well .
0
Or maybe you are talking about bitwise-and(&)?