is main() in c/c++ a function or a class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

is main() in c/c++ a function or a class?

also explain how it is so?

18th Feb 2017, 3:02 AM
just_fact
2 Answers
+ 1
It is a function, the main function. You can recognise a function because of its () parameters
18th Feb 2017, 3:07 AM
Alvin Joseph
Alvin Joseph - avatar
0
It's a function, and it is also the entry point for C/C++ programs. By definition, a C/C++ function should have a declaration consists of name, return type, and parameters. As you can see, "main()" contains a function name and empty parameter "()". main() often return integer as status notification to outside world.
18th Feb 2017, 3:12 AM
Jian-hua Yeh
Jian-hua Yeh - avatar