Implementation of string operation functions
String Length: # include <stdio. h> # include <stdlib. h> # include <assert. h> int my_strlen (const char * s) {assert (s); int n = 0; while (* s) {n ++; s ++;} return n ;} int main () {char s [] = "abcedf"; printf ("% d", my_strlen (s); system ("pause"); return 0 ;} string replication: # include <stdio. h> # include <stdlib. h> # include <assert. h> char * my_strcpy (char * s, const char * c) {assert (s); assert (c); char * q = s; while (* s ++ = * c ++) {;} return q ;}int main () {char s [10] = "abced "; char c [] = "aegdhj"; printf ("% s", my_strcpy (s, c); system ("pause"); return 0;} string comparison: # include <stdio. h> # include <stdlib. h> # include <assert. h> int my_strcmp (const char * s, const char * c) {assert (s); assert (c); while (* s ++ = * c ++) {if (* s) {return 0 ;}return * s-* c ;}int main () {char s [10] = "abced "; char c [] = "aegdhj"; if (my_strcmp (s, c) printf ("s string large"); else if (my_strcmp = 0) {printf ("string is as big as");} elseprintf ("c string is large"); system ("pause"); return 0;} string connection: # include <stdio. h> # include <stdlib. h> # include <assert. h> char * my_strcat (char * s, const char * c) {assert (s); assert (c); char * q = s; while (* s) {s ++;} while (* s ++ = * c ++) {;}return q ;}int main () {char s [20] = "abced "; char c [] = "aegdhj"; printf ("% s", my_strcat (s, c); system ("pause"); return 0 ;}