namespace
Title
Question
why it is important to use namespace in c++
C-and-Cpp First-Cpp-Program 00-01 min 0-10 sec
Answers:
A namespace refers to a collection of libraries in C++. Variable names have to be unique within a namespace, but the same variable name can be shared across multiple namespaces. For a beginner level, you will be using only the std namespace. When you mature as a programmer enough to use lots of libraries or even create libraries of your own, you will be dealing with other namespaces.
the namespace helps in avoiding the ambiguity that may occur when two identifiers have the same name.
if you don't want use namespace in C++
write like this
using namespace std;
int main()
{
std::cout << "welcome \n";
std::cout << "Here is Some Information about me \n";
return 0;
}
write individualy with every cout <<
its just for begginers
its just for begginers
if you don't want use namespace in C++
write like this
using namespace std;
int main()
{
std::cout << "welcome \n";
std::cout << "Here is Some Information about me \n";
return 0;
}
write individualy with every cout <<
its just for begginers
its just for begginers

Login to add comment