Thursday 3 October 2024

What-are the Different Ways to Write Main Functions in Programming?

 

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.

 


  1. 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.
  1. 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
  1. Void main(void)
  • The return type of the function "main" is void, i.e. it does not return anything 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.

To read other topics visit us@ http://tccicomputercoaching.com/blog/

Enrol at TCCI to learn Programming Languages.

TCCI Computer classes provide the best training in all computer courses online and offline through different learning methods/media located in Bopal Ahmedabad and ISCON Ambli Road in Ahmedabad.

For More Information:

Call us @ +91 98256 18292

Visit us @ http://tccicomputercoaching.com/

No comments:

Post a Comment