Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#CCCCFF
char *str1; 
char *str2;

if (strcmp(str1, str2) == 0) {
  return "strings are equal";
}

References

References

[1] "Should I return TRUE / FALSE values from a C function?"

Risk Assessment

Code which does not conform to the common practices presented will be difficult to maintain. Bugs may easily arise when modifying helper functions which evaluate true/false or success/failure. Bugs may also easily arise when modifying code that tests for equality using a comparison function that obeys the same conventions as standard library functions like strcmp.

...