二维字符串数组

一个二维字符串数组char a[n][m]就是有n个长度不大于m的字符串。

#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{

    char a[3][6]={"tread","micrp","soft"};
    for(int i=0;i<3;i++)
    {

        printf("%s ",a[i]);
    }

}

输出的结果为:

tread micrp soft
Process returned 0 (0x0)   execution time : 0.027 s

Press any key to continue.

要注意与数组a[n][m]区别开来 a[n][m]共有n*m个数字,而char a[n][m]共有n个字符串。







猜你喜欢

转载自blog.csdn.net/z_xindong/article/details/80914389