Почему в глобальном пространстве имен я не могу присваивать переменным значения после их объявления?
int d=5;
d=7;
int main(int argc, char const *argv[])
{
//какой-то код
return 0;
}
Компилятор выводит ошибки
warning: data definition has no type or storage class
24 | d=7;
| ^
warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int]
error: redefinition of ‘d’
note: previous definition of ‘d’ was here
23 | int d=5;
Если же убрать d=7;, то все компилируется без проблем, что не так?