Cannot assign value to global array in c++

前端 未结 2 1770
栀梦
栀梦 2021-01-15 20:27

I\'ve got this code:

 #include 
    int tabela[1];
    tabela[0] = 1;
    int main(){
        std::cout << tabela[0];
        std::cin.         


        
2条回答
  •  感动是毒
    2021-01-15 21:08

    for it to be valid C++, you can only initialize variables in global, you can't assign them there.

    edit: comments beat me to it. props

提交回复
热议问题