摘要:
In C, we cannot access a global variable if we have a local variable with same name, but it is possible in C++ using scope resolution operator (::). 1 #include 2 using namespace std; 3 4 int x; // Global x 5 6 int main() 7 { 8 int x = 10; // Local x 9 cout<<"Value of global x is "< 阅读全文
摘要:
Calling an undeclared function is poor style in C (See this) and illegal in C++. So is passing arguments to a function using a declaration that doesn’t list argument types: If we save the below program in a .c file and compile it, it works without any error. But, if we save the same in a .cpp fil... 阅读全文