+ 1

What's the meaning of *&? And what is it used for?

10th Jan 2017, 7:55 PM
memol
4 Answers
+ 8
A reference to a pointer?
10th Jan 2017, 11:31 PM
Karl T.
Karl T. - avatar
+ 2
Let's slice "*&x" a little bit: "&x" stands for the address of the variable x, just like @MohamedAhmedRamadan said. Now "*" refers to the content of a memory address. So think it like being "*(&x)": "the content of the address of x"... that is... x itself. Think of & and * being one opposite of the other.
11th Jan 2017, 10:26 AM
Álvaro
+ 1
* is used to declare a pointer "int *p;", used to get pointer's value "cout << *p;" & is used to get a variable's address "cout << &x;" prints x's address. ? is used for a conditional statement like "int A = (x > y) ? 5:3;" if x > y then A equals 5 if not A equals 3.
10th Jan 2017, 8:12 PM
Mohamed Ahmed Ramadan
Mohamed Ahmed Ramadan - avatar
0
No I mean this => *&
10th Jan 2017, 9:36 PM
memol