0
What is int?
why we use int before main()
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.
- 1
All functions have data types