answersLogoWhite

0

Can you use two main function?

Updated: 12/8/2022
User Avatar

Wiki User

14y ago

Best Answer
AnswerYes, if they are in separate source-files, and one of them is static. Of course the execution will start with the non-static 'main' function.

Answer1. If it is a multithreaded operating system (and it probably is) then you can have the Main method start another thread on another method.
2. For C programs in a Win32 console project template, Visual Studios C++ does not allow static on a main method or two main methods in one application, but you can create two separate projects which will create two separate programs.
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you use two main function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you use two main function in c?

It is not clear why would you want two functions with the same name. If you simply like the sound of word 'main', you can have one static 'main' function in each source files, but those functions won't be callable from outside.


Why you use main function in c?

Because if you donot use main function in c program, the compiler willnot execute the program.C compiler starts execution from main function itself.


Can you use main function as a recursive function in C?

Yes


Can you use arguments in main function?

Yes.


What function tests a specific condition in Excel?

The IF function is the main function to do it and you can also use other logical functions, like the AND function, the OR function or the NOT function.


Can you use two main in C programme?

No. You can only have one main() function in a C or C++ program.Note:If this question means "Will the OS start two threads/processes if I have two public scope 'main' functions in my program?"then the answer is "No, even if you could link such program, which you cannot."


What is the main work of transistors in an electronic circuit?

The main use of transistors in electronic circuits is as switches and memory storage


What are the two main functions of the ilium?

Two main function of the lilium is to absorb nutrients from digested food and to produce chyme


The main function of fats?

To store energy for later use.


The main function of fat is?

To store energy for later use.


What is CPU and write the function of its two main componentsie alu and cu?

write the function of cpu


What is the main function of carbohydrates?

Living things use carbohydrates as their main source of energy.