C -- 字符串数组与字符串指针
2016-01-21 13:51
176 查看
// 定义
char str[4][20] = {"one", "two", "three", "four"};
char str2[][20] = {"one", "two", "three", "four"};
char *str3[4] = {"one", "two", "three", "four"};
char *str4[] = {"one", "two", "three", "four"};
// 遍历
int length = sizeof(str3) / sizeof(str3[0]);
for(int i = 0; i < length; i++){
printf("%s ", str3[i]);
}
printf("\n");
char str[4][20] = {"one", "two", "three", "four"};
char str2[][20] = {"one", "two", "three", "four"};
char *str3[4] = {"one", "two", "three", "four"};
char *str4[] = {"one", "two", "three", "four"};
// 遍历
int length = sizeof(str3) / sizeof(str3[0]);
for(int i = 0; i < length; i++){
printf("%s ", str3[i]);
}
printf("\n");
相关文章推荐
- accept()
- 不存在插入的一种写法
- 想和应用宝sig签名谈谈
- Emoji表情符号录入MySQL数据库报错的解决方案(MySQL utf8与utf8mb4区别)
- linux系统中如何查看日志 (常用命令)
- 假如时光可以倒流我要如何选择
- 【转】Git patch
- mac install MySQL-python
- OpenCV人脸识别C++源码分析
- 使用MapReduce实现knn算法
- 【牛腩新闻公布系统 二】公布后,防火墙关还是不关?
- 2.7 The Object Model -- Bindings, Observers, Computed Properties:What do I use when?
- 解决Genymotion Error: “Unable to load VirtualBox Engine” on Yosemite. VirtualBox installed
- 如何衡量测试效率,如何提高测试效率!
- Android Studio导入第三方类库的方法
- SQL 循环截取法分割字符串,默认返回数据表
- Java类与对象===再谈Java包
- 给牛牛上编程课_第一次课
- iOS 开发里使用MVC编程模式项目
- 1104. Sum of Number Segments (20)