plz help...void question?

Apr 11, 2011 at 8:34pm
how to swap 2 numbers using void call by reference/call by value?
how to do it using each one seperately??
Apr 12, 2011 at 10:42am
Have you tried it?
Apr 12, 2011 at 3:03pm
This shouldn't be that hard right?
1
2
3
4
5
6
7
8
// This function should work on almost any data type
template <typename value_type>
void swap( value_type& value1, value_type& value2 )
{
    value_type temp = value1;
    value1 = value2;
    value2 = temp;
}


Pls don't blindly copy it, do you understand the code?
Last edited on Apr 12, 2011 at 3:03pm
Apr 12, 2011 at 3:23pm
Topic archived. No new replies allowed.