"return 1" in conditional statements

Hello. What does "return 1" do in conditional statements or (recursive) functions?
as far as I know, return 1 means return true, which I guess, in a recursive functions, keeps it recursiving for lack of a better word? Im not 100% sure.

You can look at what the return 0; does at the end of the program. Just closes it, return 1 must do the opposite I believe.
Last edited on
closed account (SECMoG1T)
 
"return 1"

it basically depends on the context of usage for example

1. in recursion return 1 will always be used as a "base case" to mark the end of recursion
2. in a function returning an int 'return 1, will be the resulting integral value;
3. in main returning 1, will indicate to the OS that an error occurred during the program execution;
4. in a boolean returning function retuning 1 indicates true as @tarikneaj said.
Last edited on
Topic archived. No new replies allowed.