+ 12
Please tell the difference between * pointer and &pointer
6 Answers
+ 10
The '*' character is used in declarations of pointers. The '&' is for taking the address of something. So, if you go back to the tutorials on pointers, they would be used this way:
Ninja n;
Enemy *pe = &n;
The asterisk says that 'pe' is a pointer to an Enemy and you are taking the 'address of' the Ninja 'n' with '&'.
The asterisk is also used for dereferencing a pointer. You can use '*' to dereference the pointer like this:
(*pe).attack()
which would be the same as
n.attack();
+ 8
thank you
+ 3
Hey I'm new and I really just followed some random people but could you help me out on this kind of stuff
+ 3
these are two pointer operator the first "&" is address of pointer or pointer variable and second is value of pointer variable
+ 2
the (*) is used to declare the content of a pointer whiles the (&) is used to know the memory location of the pointer, for a pointer is a variable that takes the memory address of another variable as it value.
0
hallo kavya sree.