What-are the different ways to write main functions in Programming?

Page 1

What-are the different ways to write main functions in Programming? tccicomputercoaching.com main() is main function in Programming Language where coding should be done.

There are different ways to write this main function. 1. void main()  The return type of the function "main" is void, i.e. it does not return anything to the OS.  Nothing has been said about the arguments in main, which means that you can either pass the arguments to main or not pass anything at all. 2. int main(void)  The return type of the function is "int", i.e. it is supposed to return an integer value to the OS.  "void" means that you're not allowed to pass any argument to the main. Doing this would result into a compiler error. 3. int main()  The return type of the function is "int", i.e. it is supposed to return an integer value to the OS.  Nothing has been said about the arguments in main, which means that you can either pass the arguments to main or not pass anything at all


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
What-are the different ways to write main functions in Programming? by Rosario Riley - Issuu