-
September 28th, 2003, 08:36 AM
#1
pointers
hello guys,
I want to know the difference between pointer and reference. Are these similar or not. Please explain me.
thanks.
PUNJABIAN263
***GREAT PEOPLE HAVE GREAT PUPIL***
-
September 28th, 2003, 06:30 PM
#2
Pointer and reference are similar in some ways while they are really different. It's really not easy to explain the difference but I will see if I can clarify for you.
Pointers can be used to create link lists, stacks etc but reference can't. You can de-reference a pointer. Well reference is an address whilst a pointer points to an address. So I guess what am trying to say is that a pointer can be treated as a reference but a reference can't be treated like a pointer.
I hope that helps.
Guidance...
- The mind is too beautiful to waste...
Cutty
-
September 28th, 2003, 06:51 PM
#3
read this tut if you want to learn how pointers work: http://www.antionline.com/showthread...hreadid=247055
Support your right to arm bears.
^^This was the first video game which i played on an old win3.1 box
-
September 28th, 2003, 09:19 PM
#4
Member
I guess cutty said it best when you talk about a reference you're talking about an specific space in memory where something is, the adress to it. Whereas a pointer is something that points to somewhere in memory, you usually assign this refrences to pinters. I recommend you reading about pointers for they are a little bit tricky at first but a very useful tool later on when dealing with dynamic memory specially.
http://www.codeproject.com/cpp/pointers.asp
I Speak in frequencies even dogs have trouble hearing
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
|
|