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

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

#include   //strlen
#include    //printf
#include    //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");
}

运行结果:

C语言中二维字符数组的定义和初始化_第1张图片

你可能感兴趣的:(C语言知识点杂烩,c语言)