+ 1

explain what exactly a pointer do?

8th Oct 2016, 3:40 AM
Samarth Madan
Samarth Madan - avatar
3 Respuestas
+ 1
A pointer contains the address of a variable at witch it points And to declare a pointer use the * Ex: int* p; a pointer for a int Double*p; a pointer for a double If you cout<<p ; it will give you the address in a hexadecimal number If you want a pointer to point at a variable called a you do as follows Int a; Int *p; p=&a Where &a is the address of a in the memory Now if you wanna print the value of a pointer you also use the * but in a diffrent syntax Cout<<*p ; It will give you the value of the variable In this example it will give you the value of a ;
9th Oct 2016, 8:31 AM
Carl Hajal
Carl Hajal - avatar
+ 1
a variable used to store an address of another variable...
22nd Oct 2016, 4:42 PM
sadia sharif
- 2
it points to a variable , so if you change the value of a pointer , it will change the value of the varible it is pointing too
8th Oct 2016, 2:29 PM
Ron Popov
Ron Popov - avatar