What is the meaning of using namespace in iostream library?? | Sololearn: Learn to code for FREE!

+11

What is the meaning of using namespace in iostream library??

Using namespace std;

c++

6/24/2019 4:22:17 PM

vikram Kumar

2 Answers

New Answer

+8

Using namespace std Std means "standard". When you want to use terms like cin and cout, it would be easier if you put "using namespace std" at the beginning and you can use it as usual. Else, whenever you want to use cin and cout,you have to write it this way : std::cin and std::cout. You can try refering here : https://stackoverflow.com/questions/18914106/what-is-the-use-of-using-namespace-std

+7

I agree with Joey, although using namespace statements are usually not considered good practice. They can add a lot into the global scope, and while it may look cleaner in the code, it is less specific about what you are referring to and can improve chances of causing name collisions. If there is a specific property you want, say std::cout, you could do: using std::cout; This would allow cout << ...; as with a using namespace, except only adds one function to the global scope.