Redefinition allowed in C but not in C++?
问题 Why does this code work in C but not in C++? int i = 5; int i; // but if I write int i = 5; again I get error in C also int main(){ // using i } 回答1: Tentative definition is allowed in C but not in C++. A tentative definition is any external data declaration that has no storage class specifier and no initializer. C99 6.9.2/2 A declaration of an identifier for an object that has file scope without an initializer , and without a storage-class specifier or with the storage-class specifier static ,