+ 1
Is it necessary to use " using namespace std; "?
What does it really do?
3 Respostas
+ 4
If you use "using namespace std;" you can use anything in the `std` namespace without having to type out it's full name:
`std::cout` becomes `cout`
`std::vector` becomes `vector`
It is fine for small programs but discouraged for anything else. The `std` namespace is huge and it dumps all of that into your current namespace. If you use std you can never call a variable `vector` for example because `std` will have already used the name.
better is this:
void main() {
using namespace std;
// Using std, but only inside the main function!
}
0
It's up compiler