回傳值:相同:0 不同:-1
Exemple:
#include <stdio.h>
#include <string.h>
int main ()
{
char key[] = "apple";
char buffer[80];
do {
printf ("Guess my favorite fruit? ");
fflush (stdout);
scanf ("%79s", buffer);
}
while (strcmp (key, buffer) != 0);
puts ("Correct answer!");
return 0;
}
參考出處:
http://www.cplusplus.com/reference/cstring/strcmp/?kw=strcmp
http://www.cplusplus.com/reference/cstring/strcmp/?kw=strcmp
沒有留言:
張貼留言