Quick and short: No, your functions which take pointers as parameters do not have to be of type void, for example:
CODE
bool modifiedVariables(int *number1, int *number2)
{
if (number1++ < 100 && number2++ < 100)
return true;
else
return false;
}
Useless function but it gets the point across. Basically when using pass by reference you allow function parameters to point (hence pointers) to permanent variables (normal reference variables die when the function completes), thus allowing you to modify them through the function. Usually this is used when you want to perform actions on multiple variables and have those actions be permanent (as you can only return one value from a function, or the value type you want to return needs to be different than those of reference, as above in the example).
You would pass some numbers to my function like this:
CODE
void main()
{
int myVar1=2, myVar2 = 5;
while (modifiedVariables(&myVar1, &myVar2))
cout << "Numbers < 100";
}
This post has been edited by Videege: 29 Nov, 2005 - 03:10 PM