+ 2
Pointers
What is the effective way to print out the address of the variable without using the pointer symbol.
2 Réponses
+ 8
use & sign.. like
int a=6;
cout<<"address of a"<<&a;
+ 4
What is a variable?
A variable is a piece of memory that stores a value (numbers or strings).
for example -
int a = 5 // a is variable.
now
What is a pointer?
A pointer is address of the memory (in RAM) where variable is saved.
An example -
int a = 5 ;
cout<< a ; //prints 5
cout << &a ; //prints address of variable a.
here & operator is called reference operators.
read this http://www.learncpp.com/cpp-tutorial/6-8-pointers-and-arrays/