The problem is that printf / scanf are not typical. You supply an object std::string , where printf expects const char* .
One way to fix this is to write
 printf("Hello %s", p.first_name.c_str()); 
However, since you are coding in C ++, it is recommended that you use I / O streams, preferring printf / scanf :
 std::cout << p.first_name << std::endl; std::cin >> c; 
 source share