X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrcat.c;h=dfbc135aa15df56e66784e7074cee8df676a82cb;hb=d1472915f1f94028ccbf407e7c4f858c1e1c0b20;hp=cb0c0a128d83d93cdbd8e3d43229236dc6904fa4;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old diff --git a/functions/string/strcat.c b/functions/string/strcat.c index cb0c0a1..dfbc135 100644 --- a/functions/string/strcat.c +++ b/functions/string/strcat.c @@ -5,4 +5,19 @@ // This code is Public Domain. Use, modify, and redistribute at will. // ---------------------------------------------------------------------------- -char * strcat( char * restrict s1, const char * restrict s2 ) { /* TODO */ }; +char * strcat( char * restrict dest, const char * restrict src ) +{ + char * dest_p = dest; + if ( *dest_p != '\0' ) + { + while ( *++dest_p != '\0' ) + { + // EMPTY + } + } + while ( (*dest_p++ = *src++) != '\0' ) + { + // EMPTY + } + return dest; +}