Answer the question
In order to leave comments, you need to log in
Why is it giving errors?
template <typename T>
void swap(T & a, T & b);
int main()
{
int a = 10;
int b = 12;
swap(a, b);
return 0;
}
template <typename T>
void swap(T & a, T & b)
{
T temp;
temp = a;
a = b;
b = temp;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question