+ 2

Pointers

What is the effective way to print out the address of the variable without using the pointer symbol.

1st Jun 2018, 6:47 PM
Naveen
Naveen  - avatar
2 ответов
+ 8
use & sign.. like int a=6; cout<<"address of a"<<&a;
1st Jun 2018, 6:51 PM
Scooby
Scooby - avatar
+ 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/
1st Jun 2018, 7:09 PM
Uttam
Uttam - avatar