Converting char into C char* string

I've spent hours debugging my program and overlooked this as bring the problem. Weird values have been use instead because of this.

If I were to write a numerical value, which is of type char; then need to convert this into a char* string. How would I go about doing this?
use this as a guide

void Guest::setaddress(string x)
{
// copy at most 15 characters from string to last name
const char *addressnamevalue = x.data();
int length = x.size();
strncpy(address,addressnamevalue,length);
address[length] = '\0'; // appends a null character to lasttname
}
Wouldn't memset do the same kind of thing?

I found the problem, forcing a const char* to char*, was temporarily created and removed from memory.
Last edited on
Topic archived. No new replies allowed.