+ 2
Why is the memory adress of my variable always the same? Can somebody explain me please?
Hello. I was writing a very simple program to learn working with pointers and I found an intresting fact: When it output memory adress of my variable, it is alway the same value. The program looked like this: int Age = 16; int *AgePtr = &Age; cout << AgePtr; It always output value 0x28ff18. I am new in programming comunity and I don't know how exactly computer memory works, but I thought, that it will save the variable into first free space in memory that it finds. It outputs 0x28ff18 even after restarting.
3 Antworten
+ 7
http://www-bcf.usc.edu/~dkempe/CS104/08-29.pdf
^Read through that document. It'll help educate you further on how memory works. Hope that helps your understanding.
+ 3
Thank you ^v^
+ 2
You're more than welcome! Best of luck to you in your learning.