#return 0 and 1

11 messages · Page 1 of 1 (latest)

ebon dirge
#

Im new to c but i still dont understand what return 0 and 1 doing, some people told me it back some true and false things bjt i dont understand

wind sinewBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

velvet fog
#

return code

#

it just tells the user if something went wrong

#

usually 0+ are normal exits

#

and -1 is failure

#

but it depends on what u wanna do

tranquil island
#

In simple language if a condition is true then in Boolean algebra it's defined as 1. And every false condition is defined as 0.

#

I usually use return 1 and 0 for boolean functions

#
bool positive(int n)
{
    if(n>0)
        return 1;
   else
        return 0;
}
ebon dirge
#

!solved