A noob question: "but what is that namespace thing?" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A noob question: "but what is that namespace thing?"

20th Sep 2016, 11:57 AM
Rasto Rusnacko
Rasto Rusnacko - avatar
2 Answers
0
think of namespaces as folders. each folder contains bits of code (like cout). so, when you are writing out code, you have to tell the compiler where to look for the code. so writing std::cout tells the compiler to look in std for the code relating to cout. using namespace std; tells the compiler hey, whenever you encounter a bit of code you don't understand, go ahead and look in this 'folder' for it. so std:cout becomes just cout. you run into problems if you have a function with the same name in two different namespaces. i am over simplifying it, but hope this helps.
20th Sep 2016, 12:00 PM
David Mulrooney
David Mulrooney - avatar
0
When you're writing programs in a PC, you don't need to include namespace and stuff... Just type #include<in stream.h>
20th Sep 2016, 3:48 PM
Aryaman Kashyup
Aryaman Kashyup - avatar