Variably modified array at file scope

来源:互联网 发布:js求100以内的质数 编辑:程序博客网 时间:2024/06/05 14:19

遇到这个问题好几次了,记录下:

const int N = 100005;int stack1[N];

错误信息:

error: variably modified 'stack1' at file scope

错误原因:

The reason for this warning is that const in c doesn't mean constant. It means "read only". So the value is stored at a memory address and could potentially be changed by machine code.


解决办法:

#define N  100005int stack1[N];


0 0
原创粉丝点击