Cannot assign value to global array in c++

假装没事ソ 提交于 2019-12-02 07:48:05

At the outermost level, a C++ file is a sequence of declarations. tabela[0] = 1; is not a declaration - it's a statement (in particular an expression-statement). A function body, however, is a sequence of statements, so it's fine to put this line inside the body of main (or any other function).

Some statements are declarations (called declaration-statements), but in general they're not.

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

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