What is the purpose of main( ) function?

The function main( ) invokes other functions within it.It is the first function to be called when the program starts execution.Ø      It is the starting functionØ      It returns an int value to the environment that called the programØ      Recursive call is allowed for main( ) also.Ø      It is a user-defined functionØ      Program execution ends when the closing brace of the function main( ) is reached.Ø      It has two arguments 1)argument count and 2) argument vector (represents strings passed).Ø      Any user-defined name can also be used as parameters for main( ) instead of argc and argv

Showing Answers 1 - 22 of 22 Answers

supriya ahire

  • Mar 23rd, 2006
 

    main() is the user defined function.

   main() is the first function in the program which gets called when the         program   executes.The startup code contains runmain() function which calls main() function.we can't chage the name of the main() function.

DEEPAK KUMAR MAHAPATRA(TCS KOCHI)

  • Nov 22nd, 2006
 

IT IS A SPECIAL TYPE OF FUNCTION, NOT A USER DEFIENED FUNCTION.

  Was this answer useful?  Yes

Rajen Kumar

  • Oct 17th, 2011
 

What is the purpose of main( ) function?

**It returns an int value to the environment that called the program

  Was this answer useful?  Yes

vinay

  • Aug 16th, 2015
 

Main() function invoke to OS and return all the coded word to the OS.

  Was this answer useful?  Yes

Mohit Sharma

  • Nov 18th, 2016
 

main() function or those code which execute first to call any function

  Was this answer useful?  Yes

arun

  • Feb 4th, 2017
 

It is user defined function, because function body is given by the user, What you will do with main function if we wont write anything inside main function.

  Was this answer useful?  Yes

shubhanshu sahu

  • Feb 20th, 2017
 

This is a default function, compiler enters from here and also exit from here. If you have declared various functions in program then you have to call it inside the main, otherwise they cannot be executed.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions