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

int main()

after the "main", why there are 2 parentheses whithout anything inside?

9th Feb 2017, 11:06 PM
Panas Trak
Panas Trak - avatar
2 Answers
+ 6
Parentheses are used to indicate functions and methods. They serve as containers for code that does a certain task. If the function/method needed any information to be given to it, it would be defined inside those parentheses. main() is your starting point, and also the first "task" your code performs. You'll learn how to write your own functions and methods later on.
9th Feb 2017, 11:14 PM
Tamra
Tamra - avatar
- 1
int main (int argc, char *argv[]) { // This signature can be used to retrieve command line parameters in C++ depending on your compiler }
10th Feb 2017, 12:33 AM
ChaoticDawg
ChaoticDawg - avatar