0
What is the purpose of namespace before main function???
purpose of namespace
7 Respostas
+ 5
Ok.. suppose there are two persons with the same name in a classroom. Now if the teacher calls the name it will create confusion as who among the two needs to respond. The solution would be to call the name by mentioning the location where the student is... say 1st bench etc...
Similarly in C++, namespace is used to deal with such confusions as there may be variables with the same name.
+ 4
Also defining a namespace shortens your code. Instead of using "std::cout" you can just use "cout".
+ 3
To avoid confusion ,instead of using std::cout we use cout its easy compare to writing std::cout
+ 2
namespace is used to define the boundary within which the variables and functions used inside the program exists...
+ 1
U r welcome 😊
0
can you please teach me in easy way??
0
Thank you so much .. you solved my problem! :)