Answers for "template function c++ example"

C++
1

template in c++

template <typename T>
void Swap(T &n1, T &n2)
{
	T temp;
	temp = n1;
	n1 = n2;
	n2 = temp;
}
Posted by: Guest on October-29-2020
0

function template c++

template<class T1 , class T2>
float fun(T1 a, T2 b){
    float avg2 = (a+b)/2.0;
    return avg2;
}
Posted by: Guest on September-11-2021

Browse Popular Code Answers by Language