Pointers | Sololearn: Learn to code for FREE!



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

6/1/2018 6:47:40 PM


2 Answers

New Answer


use & sign.. like int a=6; cout<<"address of a"<<&a;


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/