0

namespace std;

Guys, can anyone tell me what's the actual use of namespace std & why it's too important. :)

25th Dec 2017, 7:20 PM
N1H4R
N1H4R - avatar
3 Answers
+ 7
Interesting question! I am also learning C++ and still haven't had a good grip on this subject, and so I did little search, and in one of the results I found the following (quoted from codingunit.com) "Namespaces are used in the C++ programming language to create a separate region for a group of variables, functions and classes etc. Namespaces are needed because there can be many functions, variables for classes in one program and they can conflict with the existing names of variables, functions and classes. C++ uses namespace to avoid the conflicts." [CodingUnit - Namespaces and anonymous namespaces] https://www.codingunit.com/cplusplus-tutorial-namespaces-and-anonymous-namespaces Some other articles related to namespace in C++: http://en.cppreference.com/w/cpp/language/namespace http://www.informit.com/articles/article.aspx?p=1896673&seqNum=2 http://www.studytonight.com/cpp/namespace-in-cpp.php Thanks for bringing this up, I learned something from this question : ) Hth, cmiiw
25th Dec 2017, 7:45 PM
Ipang
+ 2
@Ipang your welcome and your response helped me a lot.
25th Dec 2017, 7:49 PM
N1H4R
N1H4R - avatar
0
it is a declarative region for the identifiers (the names of types, functions, variables, etc) inside it.
25th Dec 2017, 7:36 PM
Yesh Jadav
Yesh Jadav - avatar