Why can't I do the second method?

This is a discussion on Why can't I do the second method? within the C++ Programming forums, part of the General Programming Boards category; Working method:
Code:
sf::Vector2i *position = &sf::Mouse::getPosition();
gui.didClickButton(position);
Now, that works just fine. But, why can't I just do:
Code:
...

You seem to have an issue reading the difference between a pointer expression (&sf::Mouse::getPosition()) and a reference declaration. What I think you need to be told is that a pointer expression is not preceded by a type name, unless it is being cast the C way. Usually pointer expressions can be function arguments or values on the left hand side of an assignment statement. The difference between that and a reference declaration is that a reference declaration is a statement on its own.

sf::Vector2i& reference;
Normally you wouldn't try to use this exact statement as a pointer argument.