Function Name: strset//: Sets all characters in a string to the specified character// method: Char *strset (char *str, char c), Char *mystrset (char *str, char c) {fo R (char* pnew = str; *pnew=c,pnew++) {}}//recursive void *mystrsetdg (char *str, char c) {if (*str== ' ') {return NUL L;} Else{*str = C;MYSTRSETDG (++str, C);}} void Main () {char*p = (char[10]) {0};strcpy (P, "Night-zrf");p rintf ("p=%s\n", p), MYSTRSETDG (P, ' a ');//The string is all set to character aprintf (" P=%s\n ", p); Mystrset (P, ' o ');p rintf (" p=%s\n ", p), MYSTRSETDG (p, ' 0 ');p rintf (" p=%s\n ", p), Mystrset (P, ' rintf ');p p= %s\n ", p); system (" Pause ");}
Copyright NOTICE: This article is for bloggers original article, welcome to point out the code is bad, and put forward the Code optimization scheme. Welcome guidance, Night code, desperately struggling to update in ...
Implementation of the SYSTEM function C string: Strset