# C語言題庫-068 實現strcmp 函數。 【參考答案】 int m ystrcmp(const c har* str1, const char* str2) { assert((str1 != NULL) && (str2 != NULL)); int r et = 0; while (!(ret = (unsigned char)str1 - * (unsigned char*)str2) && *str2) { str1++; str2++; } if (ret > 0) ret = 1; else if (ret < 0) ret = -1; return ret; }
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up