How to assign a const char* to char*

I'm writing a code in which I have to pass a const char* into the class overloaded constructor and to assign this const char* to the char* variable which is a private member of the class. I'm doing this type of code but doesn't working giving an error that a const char* cannot be assigned to char* type.
Here is the code:
  Player::Player(const char* chr,int iNum)


you shouldn't assign the pointer. Instead copy the content. You need of course appropriate memory space to do so

The best would be to use std::string. if you don't want to do that you may use strcpy()
Topic archived. No new replies allowed.