answersLogoWhite

0

Why main() return zero?

User Avatar

Anonymous

9y ago
Updated: 8/21/2019

The value zero indicates success. That is; no error. A non-zero value indicates an error of some kind. We typically use -1 (the all-ones bit pattern) to indicate failure, but we can return a specific value if we wish to specify the severity or type of error. The value is returned to the hosting environment (e.g., the operating system). Not all hosting environments make use of the return value, but for portability we must return an integer. The same applies to the exit() function: we must supply a value to indicate whether the program succeeded or failed.

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

What is the return type of main?

The normal exit of program is represented by zero return value. If the code has errors, fault etc., it will be terminated by non-zero value. In C++ language, the main() function can be left without return value. By default, it will return zero. To learn more about data science please visit- Learnbay.co


Why you return zero from main?

By conventions 0 means success, everything else is error-code


What is the default return type of a function?

The normal exit of program is represented by zero return value. If the code has errors, fault etc., it will be terminated by non-zero value. In C++ language, the main() function can be left without return value. By default, it will return zero. To learn more about data science please visit- Learnbay.co


Why return 1 is used in int main function in c?

Returning a value of 1 (or any value besides zero) from main indicates an error.


Which function calls itself repeatedly?

A main (or not-main) function can return a value to its caller.If the main function was called by the system, the return value means 0=success other=error-code.Function main can call itself, but it is not common.Example:int main (int argc, char **argv){int rc;if (argc>1) rc= main (argc-1, argv+1)else rc= 0;return rc;}


What data type does the main function return in c?

The main function must return the int data type. A program that terminates normally should return the value zero to indicate no error. Not all execution environments make use of the return value (Windows in particular), however a command script or batch file can examine the ERRORLEVEL if required.


Return on equity equals return on assets?

When the debt ratio is zero


Can return statement be in a void method in java?

the main method in java is the client code therefore doesn't return any values Unlike languages like C/C++, the user doesn't specify an error return code by returning from the main method. Instead they should use System.exit(code) to do this. If the Java main method returns, the default code of zero is returned.


What are the ratings and certificates for Dispatches - 1987 Return to Year Zero?

Dispatches - 1987 Return to Year Zero is rated/received certificates of: Singapore:PG


what is the zero-moment pt?

the point of no return


How many days can you return a new car purchased in Florida?

Zero.. there is no return policy


What is the significance to the name?

main refers to the entry point of an application. All programs must have a main() function that returns an integer to the calling program or script. The return value can be used for any purpose, but generally a non-zero negative value is used to indicate that an error occurred (zero meaning no error).