0

Hello,

I've read this textbook like a-kezillion times, and i still can't understand why we use the '&' in void function.

can somebody please explain.
thanks.

ps : please don't give that lmgtfy.com thingy. it's annoying.

Edited by omgaga: n/a

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by NathanOliver
0

Please explain yourself better. Maybe post an example. To my knowledge & can be used as the address opereator, when declaring a reference variable and as a bit operator. I suspect you are trying to ask why are parameters sometimes passed to functions as references, but who knows.

0

if you are talking about this line

pv = &i

then this is used to assign to the pointer pv the address of the variable i. thus making the void pointer an int basically

if you are talking about

void Foo(int & bar) {}

then you are passing the variable by reference so that whatever happens to the variable inside the function it will be that when you get back to the calling function.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.