pointers vs references, i have a mate that uses references rather than pointers, but i use pointers. Any one better than the other? Performance wise? Which one do you use?
Lets Here It

Code: Select all
void increase_r(float &y)
{
y += 1;
}
// -and-
void increase_p(float *y)
{
*y += 1;
}
Code: Select all
float height = 0;
increase_r(height);
increase_p(&height);
// height == 2
bitplane wrote:no, references are just pointers that restrict how you code. they're like pointers little brother or something