Finally understood pointers. But what I need to understand is what can i understand from the address that I get ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Finally understood pointers. But what I need to understand is what can i understand from the address that I get ?

Pointer address

15th Jun 2019, 7:11 AM
The unknown 321
The unknown 321 - avatar
8 Answers
+ 5
It's not important to know whether your variable is located at 0x34f2d6 or at 0x2cd53f. The only case I can come up with where you do care is in reverse engineering. Your pointers care about the address, yes, but you yourself don't.
15th Jun 2019, 8:22 AM
Dennis
Dennis - avatar
+ 5
Of course pointers are important. How else are you gonna allocate from the heap. You must use pointers there. I'm just saying that in something like "int c; std::cout << &c;" It really doesn't matter to you what the address of c is. It's all handled internally for you.
15th Jun 2019, 8:35 AM
Dennis
Dennis - avatar
+ 5
long story short for the sake of simplicity your system can't do anything without RAM and of course RAM handling everything as a numerical values aka memory addresses , so logically if you can imagine the relationship between getting addresses and the importance of pointers in language level . simply you want to dig deep and manipulate stuff related to the system you have to handle allocating these system resources and of course they are limited so you have to know how to deallocate them once again . it's all connected to each other and addresses and pointers are part of that large image .
15th Jun 2019, 8:57 AM
‎وائل عبد الحق‎
‎وائل عبد الحق‎ - avatar
+ 3
you can manipulate the value of the address pointed to and even manipulate the address of the pointer itself, lots of things though which you will only know when you experiment with em
15th Jun 2019, 7:29 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
The unknown 321 you will only get this when you started writing a program with
15th Jun 2019, 8:31 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
But what will I get from the address I mean why is it important for me to know my var's location ?
15th Jun 2019, 7:34 AM
The unknown 321
The unknown 321 - avatar
+ 1
Then there's no point of using them ? Because a lot of people said that it is very important. When I get a random address how can I recognize what is it because each pointer is different than the other.
15th Jun 2019, 8:28 AM
The unknown 321
The unknown 321 - avatar
+ 1
I know they are important and I know how to use them but what confuses me is the address itself I mean what can I do with the address once I get it ?
15th Jun 2019, 8:43 AM
The unknown 321
The unknown 321 - avatar