Versions Compared

Key

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

...

The following approach to using a comparison function for this purpose is preferred. By performing an explicit test, any programmer that wishes to modify the equality test can clearly see the implied behavior and convention that is being followed.

Code Block
bgColor#ffcccc#ccccff
void login(char *usr, char *pw)
{
  User user = find_User(usr);
  if (strcmp((user->password),pw_given) == 0) {
    grantAccess();
  }
  denyAccess("Incorrect Password");
}

...