Definition of global variables using a non constant initializer

后端 未结 4 1404
夕颜
夕颜 2020-12-03 22:39
#include 

int i=10;
int j=i;
int main()
{
    printf(\"%d\",j);
}

I get an error stating that initialization element is not a const

4条回答
  •  伪装坚强ぢ
    2020-12-03 23:17

    Use this:-

    int i=10,j=1;
    int main()
    {
      printf("%d",j);
    }
    

    Though it is a minor change but it will work

提交回复
热议问题