answersLogoWhite

0

Every C program requires at least one function to coordinate the calls to all other functions. This function acts as the entry point of the application and is called "main" to indicate that it is the main function of the program. Compilation always begins with the main function so that its first statement becomes the first instruction in the machine code.

Since C++ derives from C it also requires a main function. However, every language must provide an entry point of some kind, even if it is simply the first function in a series of functions, otherwise the executable would not be able to execute.

Libraries, such as dynamic link libraries, do not require a main function since they are intended to provide dynamic functionality in order to augment one or more executables. However, they can include an optional entry-point (such as DLLMain) that is executed whenever the library is loaded or unloaded (attached or detached from a process or thread). The entry point is used to both initialise the library when attached, and perform clean-up tasks when detached.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is subroutine in 8085?

in 8085 microprocessor a subroutine is a separate program written aside from main program ,this program is basically the program which requires to be executed several times in the main program. the microprocessor can call subroutine any time using CALL instruction . after the subroutine is executed the subbroutine hands over the program to main program using RET instruction.


Which microprocessor accepts the program written for 8086 without any changes?

Which microprocessor accepts the program written for 8086 without any changes?


What powder game doesnt need java?

Any program written for the Java technology needs Java. Any program NOT written for Java DOESN'T need it.


What is base of any C program?

The base of any C program is the main function, which serves as the entry point for execution. Every C program must include this function, which is defined with the signature int main() or int main(int argc, char *argv[]). Within main, the program's logic is implemented, and it typically returns an integer value indicating the success or failure of the program. Additionally, the program may include preprocessor directives, variable declarations, and function definitions that support its functionality.


What is reading for summarizing?

A summary is one or more sentences describing a written piece. A good summary is one which tells the main character(s), the beginning, the middle, then end.


Why void is restriction in java main function?

becoz the main program doesnot return any value to the os.


Why void main is used except int main in java?

void to indicate the application is not returning the exit code to the outer calling process. The outer calling process is another program (not necessary written in java), the human invoke the program on OS level, a batch job/script, etc. It works just like any method in java. main() itself is a method.


Can you execute a C program without writing main anywhere in the program?

With special linker-options (platform-dependent) you might be able to create a program that has function 'Start' (for example), instead of 'main', but I don't see any reason in it.


Write a program in C without any functions?

It is not possible. In C, any program must have at least one function to be able to compile and execute properly: the function main()


How do you write java program using two main method?

When you start your xxxx.class it will execute its 'public static void main (String args[])' method. Any other main methods won't be executed, only if your program explicitly calls them.


Can you write a program without using any semicolon inside the main function?

not possible dude


Why is function main special?

main() is so special because it starts the execution of program. or we can say that it is entry gate of any programming language