标签: propeller-tool

C - 数组不能使用索引变量

我使用变量作为数组的索引时遇到问题.代码基本上是这样的:

int index;
void main() {
    index = 1;
    doStuff();
}
void doStuff() {
    char** myArray;
    myArray[0] = (char*)"Foo";
    myArray[1] = (char*)"Bar";
    print("%s", myArray[index]);
}
Run Code Online (Sandbox Code Playgroud)

如果我这样做:

print("%s", myArray[1]);
Run Code Online (Sandbox Code Playgroud)

它工作正常.任何人都可以帮我吗?

它应该只是C代码,但如果它很重要,它用于Parallax芯片,而我正在使用Simple IDE.

c arrays propeller-tool

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

标签 统计

arrays ×1

c ×1

propeller-tool ×1