What is different between pointers and references?
Pointer are addresses to values but i can't see what for use references?
There isn't any difference in asm :bdg
It's higher-level langauge (C++, etc) decoration really - a pointer is an address, a reference is a pointer that gets 'dereferenced' automatically (when you use it, you the get the thing it points to, not the pointer itself.)
Maybe reference is a pointer to pointer or i am wrong?
No, it's just a pointer.
But for higher-level languages (NOT asm) it's a 'magic' pointer where you get the thing it points to, not the actual pointer itself.
pavellusDid you Google (http://www.google.co.uk/search?hl=en&q=C%2B%2B+tutorial+reference&meta=) it?
This is what I found - About - C++ Tutorial - Lesson 13: References (http://cplus.about.com/od/beginnerctutorial/l/aa061002a.htm)
I don't think it is going to help you much though. It is basically what
Tedd had already told you.
Here's a quote from the page, if it makes sense to you (it doesn't mean anything me, I don't really know what it's saying! Too technical.)
QuoteA reference is not a unique object. It is merely an alias or synonym for another object. The reference identifier (name) may be used anywhere the referred identifier may be used. Any changes to the reference also apply to the original object. Changes to the original object are also seen through the reference.
Boucly
Okay, maybe an example will make it clearer.
a = 5
b = pointer_to_a
c = reference_to_a
d = b // gives the address of a - it's a pointer
d = c // gives 5 (the value of 'a') - it's a magic pointer
So that's why you said it is not an assembly thing! :U
Thanks! Funny though, I learned C++ for quite a long time but never came across references.
Boucly
Quote from: Boucly on August 22, 2006, 06:25:36 PM
I learned C++ for quite a long time but never came across references.
I'm pretty sure references only came in the most recent revision (1999, IIRC).