Q:

Function that return an error if it fails

I am wondering which of the following solutions would be the best and why. 
Solution 1
bool foo(void)
{
   if (is_true())
      return true; // Error
   else
      return false; // No error
}

Solution 2
bool foo(void)
{
   if (is_true())
      return false; // Error
   else
      return true; // No error
}

Solution 3
int foo(void)
{
   if (is_true())
      return -1; // Error
   else
      return 0;  // No error
}

Solution 4
size_t foo(void)
{
   if (is_true())
      return SIZE_MAX; // Error
   else
      return 0;  // No error
}

One will say a function named is_raining() should return false when it's not raining however, with bash a program that return 0 means success. A negative value is often considered as an error but then, how do I know how I should treat my return code?
if(foo())
   printf("Error\n");

if(!foo())
   printf("Error\n");

if(foo() < 0)
   printf("Error\n");

A:

Another method you could use is to pass the function a pointer to an error structure such as:
struct{
    int errorcode;
    char* errormessage;
} typedef Error_Structure;

void foo(Error_Structure* error){
      if(is_True()){
          error->errorcode = 1;
          error->errormessage = "it was true!";
          return;
      }
}

int main(void){
    Error_Structure error;
    foo(&error);
    if(error->errorcode != 0){
         printf(error->errormessage);
    }
}

This way with more complex applications with regards to the foo function, the error codes can be more explanatory to the developer and end user for troubleshooting errors.

