+ 1

Pointers in c++

Can anyone simplify pointers to me? Its really hard to understand.

18th Mar 2019, 12:45 PM
tobiasth2003
tobiasth2003 - avatar
6 Respuestas
+ 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))
18th Mar 2019, 3:22 PM
Zuleyha_O
Zuleyha_O - avatar
+ 6
try like this int *p, a=5; p=&a;
18th Mar 2019, 4:15 PM
Zuleyha_O
Zuleyha_O - avatar
+ 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.
19th Mar 2019, 2:34 AM
Zuleyha_O
Zuleyha_O - avatar
0
Thank you for the aswer! Now my programm tells me that & is a unknown operand. Any solution to that?
18th Mar 2019, 3:31 PM
tobiasth2003
tobiasth2003 - avatar
0
It worked. Thank you very much. But for what exactly are pointers even useful?
18th Mar 2019, 6:11 PM
tobiasth2003
tobiasth2003 - avatar
0
Thank you
19th Mar 2019, 5:28 AM
tobiasth2003
tobiasth2003 - avatar