If I you got another uptoke, I wouldn't be required to modify dj2kuptokes directly, I could just set *uptokes = 24, which would change the contents of 0x5345968D, not the address uptokes refers to. I'm changing the address contained within myuptokes, not creating a completely new int. The value of myuptokes might now be 0x5345968D If I had an int called myuptokes with the value 13 and an int called dj2kuptokes with value 24, I could easily take a int *uptokes and assign it &myuptokes and then later on decide to reassign it &dj2kuptokes. This course is the final part of a three-part series. In this course, you will learn about memory management and memory allocation, file processing, and general OOP concepts. The real value of pointers is that they're like shortcuts. In this program, you will learn and understand advanced C++ mechanics, C++ Exceptions, C++ Object Iterators, C++ Templates, and more. Mynumber, the pointer itself, is located at a completely different location, 0x3842594D, which could be obtained with &mynumber, "address of the pointer mynumber". Printing mynumber would return 0x5932849F, printing *mynumber would return 4. Let's say int *mynumber's value is 0x5932849F, which is where mynumber actually is. I keep editing this trying to eliminate explaining irrelevant aspects. Honestly the thing that helped me the most was thinking very intently about the fact that "&" means "address of", and "*" means "the contents of an address".
0 Comments
Leave a Reply. |