0

how pointers work?

13th Jun 2016, 2:10 PM
MKS monkey
MKS monkey - avatar
4 Réponses
+ 2
int x=20; int *p; p=&x; cout<<x; //output - 20 cout<<p; //output - address of x cout<<*p; //output - value of x(20)
13th Jun 2016, 5:18 PM
Lekhraj Singh
Lekhraj Singh - avatar
+ 1
a pointer stores the address to a variable instead of storing the actual value
13th Jun 2016, 2:38 PM
Alex
0
pointers are also faster? modifying the actual variable in memory Instead of loading the variable then modify the variable then store the variable back to memory.
13th Jun 2016, 11:33 PM
terry miller
terry miller - avatar
0
is *p a pointer or p with star (ignoring *)
14th Jun 2016, 4:51 AM
MKS monkey
MKS monkey - avatar