Sunday, April 11, 2010

Passing pointer by reference....

okay I understand, the title sounds contradictory, but trust me, this concept exists.

So first, why pointer? the answer is simple, if you have to return multiple values from a function, the only way you can do it is, through pointer (noodle over it).

This can be done two ways, one is having the function return the pointer. Like...

int * ReturnSortedInteger(int *arrToSort).

Now the other way to do this is....
void ReturnSortedInteger(int *arrToSort, int *& SortedIntegerArray)...

No comments:

Post a Comment