std::string str = "Hello";
printf(str); // 错误,应该使用 printf("%s", str.c_str());
std::string str = "Hello";
printf("%s", str); // 错误,应该使用 printf("%s", str.c_str());
std::string str = "Hello";
printf("%s", str.c_str()); // 没有换行符
std::string str = "Hello";
printf("%d", str.c_str()); // 错误,应该使用 %s 占位符
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>