当前位置:   article > 正文

C语言中二维字符数组的定义和初始化_c语言二维数组初始化汉字

c语言二维数组初始化汉字

关于二维字符数组的定义和初始化。

  1. #include<string.h> //strlen
  2. #include<stdio.h> //printf
  3. #include<ctype.h> //tolower、toupper
  4. int main()
  5. {
  6. char testcase1[4][100] = { "one","two","three","four" };
  7. char* testcase2[4] = { "2one","2two","2three","2four" };
  8. int i;
  9. for (i = 0; i < 4; i++)
  10. {
  11. printf("%s\n", testcase1[i]);
  12. }
  13. printf("\n");
  14. for (i = 0; i < 4; i++)
  15. {
  16. printf("%s\n", testcase2[i]);
  17. }
  18. printf("\n");
  19. }

运行结果:

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/319733
推荐阅读
相关标签
  

闽ICP备14008679号