mang
is one of the parameters of your function, so you have a variable by that name. You can not declare a second variable with that name...
First declaration:
void nhapchuoi(ptr &mang, int &n)
Second declaration:
ptr mang = new char[n];
If you mean to assign value to that variable than remove the type definition form the beginning of the line:
ptr mang = new char[n];