+ 1

What is use of * asterisk operator in pointer

26th Mar 2018, 7:14 PM
Mrityunjay Tiwari
Mrityunjay Tiwari - avatar
2 Answers
+ 1
* is used to create pointers or used as the dereference operator which basically grabs the value of the memory location it is pointing to. Like int var = 70; int *ptr = &var; cout << ptr << endl; // prints var memory location cout << *ptr << endl; // prints 70 (var's value)
26th Mar 2018, 7:28 PM
TurtleShell
TurtleShell - avatar
+ 1
thank you
26th Mar 2018, 7:28 PM
Mrityunjay Tiwari
Mrityunjay Tiwari - avatar