本文主要是介绍Variably modified array at file scope,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
遇到这个问题好几次了,记录下:
- 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 100005
- int stack1[N];
这篇关于Variably modified array at file scope的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!