-
C++ Reference/Pointer Tutorial
I have created this reference/pointer tutorial for all C++ users who may or yet may have not completely understood the usage, meaning, and convenience of references and pointers and not to replace the many useful C++ programming books.
Alright, let's get to the point:
references are basically objects that are used in C++ of which refer to memory locations on the heap. It is actually pretty simple. If you change a reference, it will change the (variable-of-which-is-referred-to-by the-reference)'s value.
pointers are basically objects that are used in C++ of which point to memory locations on the stack. It is actually pretty simple. If you give a pointer a memory address, the value of the memory cubby is equivalent to the memory address's value in which is pointed to by the pointer.
These are very helpful and useful objects that are used in programming.
-magicyte
Last edited by magicyte; 08-27-2008 at 10:04 PM.
-
-
-
-
I'm sure you have...

<
>
In fact, I've only been with C++ for a year. Any suggestions on how to teach? I understand much, but I do not know how to preach my knowledge. Well, that is.
-magicyte
-
-
You could perhaps go into some form of detail
Also, you're wrong about references: they point to exactly the same places as pointers, which can be on the stack or the heap: the stack is used for statically-assigned memory, while the heap is used for dynamically-assigned memory (allocated with malloc() and friends). The sole purpose of references is to be safer and more convenient by removing the need to work explicitly with pointers, but they're basically just pointers behind the scenes.
-
-
Thanks!! Where do you learn this stuff? Books? College? By the way, if you went to college, which one and what did you get degrees in?
-magicyte
P.S. <
>

- You're probably laughing your head off now, unless (multiple reasons)
P.P.S. Thank you for correcting me. If you hadn't, the whole world would have seen my mistake. (By the whole world, I imply the countries that have access to this website)
Last edited by magicyte; 08-27-2008 at 09:08 PM.
-
-
The Internet. No, I'm a 'high-school' drop-out.
-
-
You are saying you didn't go to college? And what do you mean by 'high-school' dropout?
What is Twey? Is that a name or catchy username?
-magicyte
P.S. Where on the internet? Specific websites?
-
-
You are quite correct, and I meant that here in England we do not in fact have 'high-school' as the term is usually used. 'Twey' is both my username and nickname.
I can't give a list of everything, no, but you might enjoy the C++ standard draft.
-
-
Thank you very much. One last unimportant question: do you have an english accent?
(doo yoo hauv un eenglish aucksent)?
-magicyte
-
-
Rather unsurprisingly. My accent is notable only by virtue of being exceptionally generic. I believe it to be more or less English, yes, although fellow English-speakers often have difficulty placing it.
What was that impression supposed to be? Sounded kind of Austrian.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks