What is namespace and why it can be used in C++?
Answers
Namespace is a feature added in C++ and not present in C. A namespace is a declarative region that provides a scope to the identifiers (names of the types, function, variables etc) inside it. Multiple namespace blocks with the same name are allowed. All declarations within those blocks are declared in the named scope.
A namespace is a set of signs( names) that are used to identify and relate to objects of colorful kinds. A namespace ensures that all of a given set of objects have unique names so that they can be fluentlyidentified.It's a declarative region that provides a compass to the identifiers( the names of types, functions, variables, etc) inside it. Namespaces are used to organize law into logical groups and to help name collisions that can do especially when your law base includes multiplelibraries.A train path, which uses syntax defined by the operating system, is considered a namespace. For illustration, C Program lines Internet Discoverer is the namespace that describes where Internet Discoverer lines on a Windowscomputer.Namespace is a point added in C and not present in C. A namespace is a declarative region that provides a compass to the identifiers( names of the types, function, variables etc) inside it. Multiple namespace blocks with the same name are allowed. All affirmations within those blocks are declared in the named compass.
So whenever the computer comes across cout, cin, endl or anything of that matter, it'll read it as stdcout, stdcin or stdendl. When you do not use the std namespace, the computer will try to call cout or cin as if it were not defined in a namespace( as utmost functions in your canons).
#SPJ2