I wrote the following code:
template <typename T>
void myname(T* x)
{
cout<<"x is "<<x;
}
and I Invoked:
char *p="stackOverflow";
myname(p);
It prints stackOverflow
.
But if I change the template argument from (T* x)
to (T x)
I get the same result.
So what is the difference between the two template parameters?
void myname (T x)
and
void myname (T* x)