What is int? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is int?

why we use int before main()

2nd Aug 2016, 2:18 PM
AKASH SHARMA
AKASH SHARMA - avatar
2 Answers
+ 5
main returns to the operating system. the integer it returns is just a way to tell the OS the exit status of the program, where 0 means everything ran fine and anything else is an error edit: i just reread the question and i think you meant why we write the int in the first place and not why it returns an int. youll learn about that when you get to the 'functions' part of the tutorials, just keep in mind that main is like any other function, it just gets called by the OS when the program starts.
2nd Aug 2016, 2:40 PM
Bernhard .Speicher
Bernhard .Speicher - avatar
- 1
All functions have data types
2nd Aug 2016, 3:24 PM
Calvin Pierce
Calvin Pierce - avatar