+ 1
Pointers in c++
Can anyone simplify pointers to me? Its really hard to understand.
6 Answers
+ 8
pointers help to store address of another variable =>
int *p;
p=&5;
cout<<p; // output is address of 5
//not value
cout<<*p; // output is 5-value
//itself
try yourself))
+ 6
try like this
int *p, a=5;
p=&a;
+ 6
Pointers are used in C++ program to access the memory and manipulate them.
Each variable you create in your program is assigned a location in the computer's memory.
C++ gives you the power to manipulate the data in the computer's memory directly. You can assign and de-assign any space in the memory as you wish. This is done using Pointer variables.
0
Thank you for the aswer!
Now my programm tells me that & is a unknown operand. Any solution to that?
0
It worked. Thank you very much. But for what exactly are pointers even useful?
0
Thank you