gpt4 book ai didi

C 2D 字符数组 ("Warning initialization from incompatible pointer")

转载 作者:行者123 更新时间:2023-11-30 19:06:56 24 4
gpt4 key购买 nike

我想创建一个二维字符串数组,所以我尝试这样做:

char **value[] = {"integer", "char", "string", "octal", "hexa_min", "hexa_maj", "pointer", "integer", "bin_int", "non_printable", "unsigned_int", NULL};

但是我的数组的每个 str 都有一个警告。

https://pastebin.com/bwJtB1CR

感谢您的帮助;)

最佳答案

char value[12][30] = {
"integer",
"char",
"string",
"octal",
"hexa_min",
"hexa_maj",
"pointer",
"integer",
"bin_int",
"non_printable",
"unsigned_int",
"NULL"};

在声明二维数组时请务必记住如下所示:array2D[行数][列数];

关于C 2D 字符数组 ("Warning initialization from incompatible pointer"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47375828/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com