plz help...void question?

how to swap 2 numbers using void call by reference/call by value?
how to do it using each one seperately??
Have you tried it?
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
Topic archived. No new replies allowed.