old_password.equals(new_password)

Oh wait that's java. Maybe C has something similar.