typedef long size_t; /* ** void *memcpy(void *s1, const void *s2, size_t n); ** ** The memcpy function copies n characters from the object pointed to by s2 ** into the object pointed to by s1. If copying takes place between objects ** that overlap, the behavior is undefined. ** ** The memcpy function returns the value of s1. ** */ void *memcpy(void *s1, const void *s2, size_t n) { char *source = s2; char *dest = s1; int i; for (i=0; i *m2) return 1; m1++; m2++; } if (*m1 == *m2) return 0; else if (*m1 < *m2) return -1; else if (*m1 > *m2) return 1; } /* ** int strcmp(const char *s1, const char *s2); ** ** The strcmp function compares the string pointed to by s1 to the string ** pointed to by s2. ** ** The strcmp function returns an integer greater than, equal to, or ** less than zero, accordingly as the string pointed to by s1 is greater than, ** equal to, or less than the string pointed to by s2. */ int strcmp(const char *s1, const char *s2) { while (*s1 && *s2) { if (*s1 < *s2) return -1; else if (*s1 > *s2) return 1; s1++; s2++; } if (*s1 == *s2) return 0; else if (*s1 < *s2) return -1; else if (*s1 > *s2) return 1; } char string1[16] = "hello, world\n"; char string2[16] = " "; void main(void) { strcpy(string2, string1); puts(string2); }