what is the diffrence beteen void main(), return 0 and using nameplace | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the diffrence beteen void main(), return 0 and using nameplace

12th Jun 2016, 7:19 PM
CHURCHIL
CHURCHIL - avatar
3 Answers
+ 2
void main is your programs main function. the using namespace std is for importing the standard library; it basically inserts everything you would need if you called code from something in the standard library before it's used in your code so the compiler has reference of it. *edit* using Namespace is a way of telling the Compiler to look for the library you are going to call for example std or the Standard Template Library.
12th Jun 2016, 8:25 PM
Jacob Wellman
Jacob Wellman - avatar
+ 1
now i got it thanx
13th Jun 2016, 4:38 AM
CHURCHIL
CHURCHIL - avatar
+ 1
All Standard Library functions and variables are declared in a namespace "std" to avoid names ambiguity. E.g. cout is actually declared as std::cout and should be called like that if you'll omit "using namespace std".
13th Jun 2016, 6:46 AM
Igor Korablev
Igor Korablev - avatar