help with strcat

John Gordon gordon at osiris.cso.uiuc.edu
Thu Jun 6 01:15:13 AEST 1991


>>could someone show me some example code to take
>>two char strings and combine them into another char 
>>string.

>char *str1 = "Joseph went";
>char *str2 ' " to the store.";
>char str3[100];

>strcat(str3, str1); /* tacks str1 onto the end of str3 */
>strcat(str3, str2); /* tacks str2 onto the end of str3 */

>/* str3 should now be "Joseph went to the store." */

	OK, OK, so I made a mistake.  The first strcat() should be a strcpy().

John



More information about the Comp.lang.c mailing list