Archived

This topic is now archived and is closed to further replies.

_elmo

Functions

Recommended Posts

_elmo    122
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???

Share this post


Link to post
Share on other sites
iamwithstupid    326
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]

Share this post


Link to post
Share on other sites