相关疑难解决方法(0)

字符串数组转换

我有以下代码:

char *array1[3] = 
{
    "hello",
    "world",
    "there."
};

struct locator_t
{
    char **t;
    int len;
} locator[2] =
{
    {
        array1,
        10
    }
};
Run Code Online (Sandbox Code Playgroud)

它用"gcc -Wall -ansi -pedantic"编译好.但是对于另一个工具链(Rowley),它抱怨

warning: initialization from incompatible pointer type
Run Code Online (Sandbox Code Playgroud)

在char**t的行上.这确实是非法的代码还是没问题?

谢谢你的回答.我现在知道我的问题在哪里.但是,它提出了一个新问题:

字符串数组初始化

c ansi-c

8
推荐指数
1
解决办法
174
查看次数

标签 统计

ansi-c ×1

c ×1