Int main() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Int main()

I understand what this means but I don’t understand why there is the () after it. I am pretty sure that I need it, I’m just wondering why

13th Nov 2019, 8:20 PM
Christian0972
6 Answers
+ 8
Christian0972 because "main" is a function and this is how a function should be defined <Return type><function name>(<parameters>) Int main() Means "main" function will return integer value but will not need argument to be executed(or we can say that it will need "void" to be executed)
14th Nov 2019, 2:49 AM
Arsenic
Arsenic - avatar
+ 5
Ace Yes thats right i forgot to say that. I was only talking about the case when you dont want to use the arguments.
13th Nov 2019, 9:01 PM
Jnn
Jnn - avatar
+ 4
the functions return an example sum value (int a, b) this function will return the sum of a and b the parenticis "()" main function indicates that they do not return any value in the sololean course c there are lessons about the functions
15th Nov 2019, 3:34 PM
Brangie Coronado
Brangie Coronado - avatar
+ 3
Because this function has no parameter. Always when you define a function on your own without parameters you would also put () behind the name
13th Nov 2019, 8:26 PM
Jnn
Jnn - avatar
+ 3
If you don't put, it becomes a variable. if you put, it refers to as a function, so a function should have (). A main() is also a function and starting point of program execution.
13th Nov 2019, 8:42 PM
Jayakrishna 🇮🇳
+ 3
Everything in c starts with main function ,we use paranthesis for function Syntax
15th Nov 2019, 6:50 PM
MNC
MNC - avatar