C编译错误:Main.c:4:5: error: variably modified ‘f’ at file scope int f[maxn];

半腔热情 提交于 2020-04-04 13:49:42

错误范例:

  

#include<stdio.h>

const int maxn=10000+10;
int f[maxn];
int cnt;

 

错误原因:

C中const不是指常量,而是表示只读;const声明常量是在C++中的用法

C中声明一个固定长度数组,可用:

  

#define MAXN 256
int f[MAXN];

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!