answersLogoWhite

0


Best Answer

Every C++ program must have a main() function that returns an integer:

int main()

{

// user-code goes here....

// Main must return an integer to the calling program.

// A non-zero value usually indicates an error occurred but

// the exact meaning of the return value is user-defined.

return( 0 );

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What function must be in all c plus plus programs?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the only function all C plus plus programs must contain?

Every C plus plus program that is a main program must have the function 'main'.


Write a program to return a function using class in C Plus Plus?

Classes cannot return values, only functions can return values. But you cannot return a function from a function, you can only return a function pointer -- a pointer variable holding the address of the function you wish to return. All possible return values must be of the same type, therefore all function signatures and return types must be exactly the same -- only the name of the functions can differ.


Which function is used to remove all elements from a map in c plus plus?

map.clear()


Why can't the accessor member function change any of the values in a class in C plus plus?

Nothing stops a member function from changing any of the values in a class. By convention, an accessor function is used to give read only access to class data, but that does not mean that it is prohibited from doing so. It is a member function, after all, and it has all the rights of any member function of the class.


How do you write a function in Turbo C Plus Plus?

// declaration: return_type function_name([argument_type_1[=value][, argument_type_2[=value][, ...]]]); // definition (function signature must match declaration): return_type function_name([argument_type_1 argument_name_1[, argument_type_2 argument_name_2[, ...]]]) { // implementation } In the case of separate declaration/definition, the definition file must include the file that contains the declaration unless they are both in the same file. If the function is a template function, both the declaration and the definition must be visible to the compiler BEFORE it can be used (thus they must both be in the same file). For all other functions other than inline expanded functions, only the declaration need be visible. Note that the definition is also a declaration, however default values must be omitted and all arguments must be named. The declaration arguments may also be named but they needn't match those in the definition (the definition names are the ones actually used). Alternatively: // combined declaration and definition: return_type function_name([argument_type_1 argument_name_1[=value][, argument_type_2 argument_name_2[=value][, ...]]]) { // implementation } Functions that are defined in the declaration are impicitly inline expanded. Functions that are defined separately must be prepended with the inline keyword in the definition, and the definition must be visible to the compiler BEFORE the function can be used. Functions that do not return a value must return void. If any other return type is specified, the function must explicitly return that type via all return paths. The main function must return an int, however return(0) is implied if not specified in the final statement.

Related questions

What is the only function all C plus plus programs must contain?

Every C plus plus program that is a main program must have the function 'main'.


Which function must all C plus plus programs contain?

An entry point, usually main().


Why is a main function used by Grady Booch in C plus plus?

All C++ programs require an entry point and the main function provides that entry point.


Can all C programs are executable in C plus plus?

Some C programs can be compiled in C++, yes.


Write a program to return a function using class in C Plus Plus?

Classes cannot return values, only functions can return values. But you cannot return a function from a function, you can only return a function pointer -- a pointer variable holding the address of the function you wish to return. All possible return values must be of the same type, therefore all function signatures and return types must be exactly the same -- only the name of the functions can differ.


Which function is used to remove all elements from a map in c plus plus?

map.clear()


What Function Specific Training must be?

All of the above


What is function specific training must be?

All of the above


Which two of the following roles must function effectively for society as a whole to function effectively?

All Parts Must work together in Harmony


3 Why is it correct to conclude that all managers are involved in the human resource management function and implementing HRM activities and programs?

It is correct to conclude that all managers are involved in the human resource management function and implementing HRM activities and programs. This is because the managers will have to interact with employees at on point or another which is a human resource function.


What is well behaved wave function?

List of the characteristics a well-behaved wave function are ..The function must be single-valued; i.e. at any point in space, the function must have only one numerical value.The function must be finite and continuous at all points in space. The first and second derivatives of the function must be finite and continuous.The function must have a finite integral over all space.


Which term describes all the programs needed for a computer and its peripheral devices to function properly?

system software