Skip to main content
gamedev.net
🔒 Locked

Functions

Started by _elmo Jan 30, 2003 at 7:02 AM 0 replies 500+ views
Original Post
_elmo
_elmo
I''ve got a question about function declaration (and implementation). Sometimes I''ll see a function declaration such as: void function(vector* v); and sometimes I''ll see a function declaration such as: void function(vector& v); What is the difference between the two declarations... And which should you use???
elmo
iamwithstupid
iamwithstupid
void function(vector* v); - this is a pointer
void function(vector& v); - this is a Reference

A reference is like a dereferenced pointer, you should use the reference if you want to point directly to the value stored in that part of the memory and use pointers if you want to see the memory address.

thanks
jack



[edited by - iamwithstupid on January 30, 2003 12:08:24 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.