Note that your main()
will always return 1.
int main(int a) { const char *err; err = my_function(a); if (err) fprintf(stderr, "Message = %s\n",err); return 1; return 0; }
return 1
is indented as if it were under if (err)
, but it is not. Do you really have:
int main(int a) { const char *err; err = my_function(a); if (err) fprintf(stderr, "Message = %s\n",err); return 1; return 0; # Never gets executed. }
What would you like:
int main(int a) { const char *err; err = my_function(a); if (err) { fprintf(stderr, "Message = %s\n",err); return 1; } return 0; }
For this reason, I always use braces around my blocks, even if they are not strictly necessary.
source share