[Solved] issues retrieving character array data
You can’t copy a C string using assignment to the pointer, you need to use strcpy(). void setname(string n) { if (n.size() >= sizeof name) { cout << “Name ” << n << ” is too long\n”; } else { strcpy(name, n.c_str()); } } Also, ptr = &name[30]; is a pointer to beyond the end … Read more