赞
踩
关于二维字符数组的定义和初始化。
- #include<string.h> //strlen
- #include<stdio.h> //printf
- #include<ctype.h> //tolower、toupper
- int main()
- {
- char testcase1[4][100] = { "one","two","three","four" };
- char* testcase2[4] = { "2one","2two","2three","2four" };
- int i;
-
- for (i = 0; i < 4; i++)
- {
- printf("%s\n", testcase1[i]);
- }
- printf("\n");
-
- for (i = 0; i < 4; i++)
- {
- printf("%s\n", testcase2[i]);
- }
-
- printf("\n");
- }
运行结果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。