ZhangZe

Computer World--Linux, BSD

博客园 首页 新随笔 联系 管理

2010年12月4日 #

摘要: C++中可以用三种方式存储字符串:1.字符数组char str[] = “hello, world!”;char str[] = {“hello, world!”};二者等价(只能在初始化的时候这样写,不能先定义一个字符数组,再用字符串常量赋值!)字符数组的长度是字符串长度加1,因为字符串常量会自动加一个‘\0’;sizeof... 阅读全文
posted @ 2010-12-04 14:41 ze_zhang 阅读(371) 评论(0) 推荐(0) 编辑