• 首页
  • 前端技术
  • 编程语言
  • 人工智能
  • 运维知识
  • 资源下载
  • 常用小工具
  • 技术问答

[导入]C风格字符串与string类型

2021-06-02

C风格字符串等价于string 类型字符串字面值

string str1("Hello!"); //ok.

char *str2 = str1; //error.

char *str3 = str2.c_str(); //ok. but not quite.

//注意c_str()返回的数据类型是const char

const char *str4 = str2.c_str(); //ok.[导入]C风格字符串与string类型[导入]C风格字符串与string类型
文章来源:http://liyuxia-life.spaces.live.com/Blog/cns!DA1B364675ACF35!232.entry

[导入]C风格字符串与string类型

幸运草 2009-02-27 21:18 发表评论

相关文章:

猜你喜欢
相关资源
相似解决方案
热门标签
Java Python linux javascript Mysql C# Docker 算法 前端 SpringBoot Redis Vue spring 设计模式 .net core .net kubernetes c++ 数据库 数据结构 大数据 js 机器学习 微服务 Android Go 程序员 面试 JVM ASP.net core 云原生 人工智能 后端 PHP git CSS golang k8s Nginx Django mybatis 深度学习 多线程 React 架构 devops 爬虫 云计算 Spring Boot LeetCode
By © 2026 likecs 版权所有,
本站所有数据收集于网络如有侵犯到您的权益请联系 进行下架处理1。
粤ICP备22038628号Powered By WordPress