At the following web page: http://web.mit.edu/qt-dynamic/www/tu...torial-t2.html
In:
Why is & used with quit and app? Cannot we use quit and app without &?
Thanks.
Printable View
At the following web page: http://web.mit.edu/qt-dynamic/www/tu...torial-t2.html
In:
Why is & used with quit and app? Cannot we use quit and app without &?
Thanks.
connect expects a pointer.
"&" refers to the memory adress of the variable quit
"&" (in this context) means "take the address of what follows". In the example you quote, it's being used because "quit" and "app" are objects, and "connect" simply wants pointers to objects.
In other cases the construct might be used on a call so that a paramater could be modified by the callee. Eg:
Code:
int width; int height; height = getEiffelTowerDimensions(&width); .... int getEiffelTowerDimensions(int* width) { *width = 100; return 300; }