answersLogoWhite

0

What is return value 1?

Updated: 12/20/2022
User Avatar

Wiki User

13y ago

Best Answer

Return value 1 from a function is a true value and generally means success.

Return value 1 from the outermost function, i.e. to the shell, however, is a failure indication, and the value is dependent on the design of the code.

In other words: context-dependent, always consult the documentation.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is return value 1?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

Can we perform bitwise circular shift in c?

Yes: unsigned char CircLeft (unsigned char value) { if (value&0x80) return (value<<1) + 1; else return (value<<1); } unsigned char CircRight (unsigned char value) { if (value&0x01) return (value>>1) + 0x80; else return (value>>1); }


What is the functions would return a value of 8?

int myfun (void) { return 4*2*1; }


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.


Difference in using a method that return value and method that does not return value in object orinted programming?

A method that return a value should have a return statement. The method signature should indicate the type of return value. While in the case of a method that does not return a value should not have a return statement and in the signature, the return type is void. When using a method that doesn't return a value, a programmer can not get a value from that function, but instead, it can only change variable values and run other methods.


How do you write a C Program to Print all the Prime Numbers between 1 and 100.?

C does not prove a built-in function to determine if a number is prime or not, thus we must write one. The implementation is reasonably trivial: bool is_prime (unsigned int value) { if (value<2) return false; if (!(value%2)) return value==2; unsigned int max_factor, factor; max_factor = sqrt (value) + 1; for (factor=3; factor<max_factor; factor+=2) if (!(value%factor)) return false; return true; } That is; we return false when value is less than 2 (because 2 is the first prime). If the value is even, we return true if the value is 2 (because 2 is the only even prime). For all other values greater than 2, we divide the value by increasing odd factors (3, 5, 7, 9, etc) up to the square root of the value. If the value is evenly divisible by any of these (potential) factors, the number cannot be prime so we return false. If none of the potential factors evenly divides into the value, the value is prime so we return true. Given this function, we can now create another function that will determine the next prime after any given value (the given value need not be prime). unsigned int next_prime (unsigned int value) { while (!is_prime (++value)); return value; } Here we increment the value until the is_prime() function returns true, at which point we return the value, which is now prime. Now we can print all the prime numbers from 1 to 100: int main (void) { int n; n=1; while ((num=next_prime (num))<=100) { printf ("%d\n", num); } return 0; }


What is wrong with not writing a return statement in value-returning method in java?

It is a syntax error, because a value returning method must return a value, and not writing a return statement with a value is tantamount to returning without a value.


What is return in programming?

The return statement is used in functions to return control to the caller. If the function is declared non-void, the return statement also allows the programmer to return a value to the caller.


How do you return a value in a PHP function?

Below is a simple example of how you could return a value in a PHP function. <?php function returnme($value) { return $value; } echo returnme('hello'); // outputs: hello ?>


What is a return statement used for?

It means end the function. Functions automatically end when execution reaches the end of the function, but you can return from a function at any point within the function with a return statement. If the function returns a value to its caller, you must provide a reachable return statement along with the value you wish to return.


Is there a difference between you plus plus and plus plus you?

you++ will return the current value of you and increment it. ++you will increment it and then return the new value of you. So, for example: int you = 0; cout << you++; // this will print 0 cout << you; // this will print 1 int you = 0; cout << ++you; // this will print 1 cout << you; // this will also print 1


Can you use printf as a return value?

No, it is a function. But printf does return a value: the number of characters it has written.


What statement returns a value from a function?

return