string.h
extern int strcmp(const char*,const char*); extern char* strcpy(char*,const char*);
string.c
int strcmp(const char *cs, const char *ct) { unsigned char c1, c2; while (1) { c1 = *cs++; c2 = *ct++; if (c1 != c2) return c1 < c2 ? -1 : 1; if (!c1) break; } return 0; } char *strcpy(char *dest, const char *src) { char *tmp = dest; while ((*dest++ = *src++) != ‘\0‘) /* nothing */; return tmp; }
时间: 2024-10-29 14:09:57