answersLogoWhite

0

Where do c plus plus begin execution?

Updated: 10/26/2022
User Avatar

Wiki User

14y ago

Best Answer

C++ begins its execution at int main(...parameters...) or int WINAPI WinMain(...parameters...). WinMain() is used in Win32 programming, for windows, message boxes etc. main() is used in console programming.

int main() either have no parameters ( int main()) or it can have two parameters ( int main(int argc, const char* argv[]) ). int argc is the argument count, and const char* argv[] is the argument vector (the values of the arguments). These parameters are only useful if you need to take arguments from the user when you start up the application.

int WINAPI WinMain() must have four parameters. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdParam, int nCmdShow). WINAPI is a method of passing parameters which comes from the days of Fortran and Pascal. It reverses the order the parameters are passed. Why this is necessary is not important WINAPI is simply required by Windows. HINSTANCE hInstance is a handle (a pointer) to the current application instance. HINSTANCE hPrevInstance is a handle to the previous instance. In theory, if there are multiple copies of an application open, then this would point to the last one created. LPSTR lpCmdParam is a long pointer to the command line calling existence to the application. If you were to open, let's say, "MyWin32App.exe" then this would be what lpCmdParam is pointing to. If you were to open "MyWin32App.exe -StartFullscreen" then that would be what it is pointing to. int nCmdShow is the parameter indicating how the window should be opened. You could start the application minimised, maximised etc.

References:

http://www.directxtutorial.com/Tutorial9/A-Win32/dx9A2.aspx

http://en.wikipedia.org/wiki/Main_function_(programming)#C_and_C.2B.2B

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Where do c plus plus begin execution?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

The symbol that represents a logical OR in Java C plus plus and C?

a b Note: 'shortcut' execution, so (a==0 b/a==1) is legal even if a==0


Where does c language program begin execution?

The execution of the program starts with function main, wherever it is in the source.


What are the usage of IF statement in C plus plus program?

Conditional execution. if (1==2) puts ("Wow, 1==2"); else puts ("No, 1<>2")


Which word is reserved in c plus plus?

All C++ keywords are reserved, as are all variable and function names that begin with two leading underscores.


Control statement in c plus plus?

Control statements are statements that alter the flow of execution according to the evaluation of an expression (the condition). The C++ control statements are ifstatements, switch statements and the tertiary conditional operator, ?:.


Parts of the program C plus plus?

parts of a programStructure of C++ programDocumentation SectionPreprocessor SectionDefinition SectionGlobal Declaration Sectionmain(){Declaration part;Executable part;}sub program section{Sub program execution part}


Four step that are necessary to an a program an a completely dedicated machine?

i. Reserve Machine Time; ii. Manually Load the program into the memory. iii. Load the starting address and begin execution. iv. Monitor and control execution through the use of Console.


What are the four steps to run a program on a completely dedicated machine?

a) Reserve Machine Time b) Manually Load Program Into Memory c) Load Starting Address And Begin Execution d) Monitor And Control Execution Of Program From console


What is executive a c program?

I think it is 'execution of a C program'.


List the four steps that are necessary to run a prog on completely dedicated machine.?

a. Reserve machine time. b. Manually load program into memory. c. Load starting address and begin execution. d. Monitor and control execution of program from console.


Explain control instructions in c plus plus?

Control instructions are instructions that alter the flow of execution. In C++ this include if, if-else statements, switch-case statements and the conditional ternary operator (?:), as well as loop structures (for, while, do-while) and procedural goto statements.


What is b plus b plus b plus c plus c plus c plus c?

b+b+b+c+c+c+c =3b+4c