Why should I use *&
after the type name (T*&
) in the following code? Isn't a
a pointer to a pointer? If it is, then why should I not use **
instead?
template <class T> void CreateArray(T*& a, int n)
{
a = new double[n];
}
int main()
{
double* a;
CreateArray<double>(a,3);
return 0;
}