I\'ve got this code:
#include
int tabela[1];
tabela[0] = 1;
int main(){
std::cout << tabela[0];
std::cin.
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