help with strcat
Kenneth Herron
kherron at ms.uky.edu
Wed Jun 5 07:39:35 AEST 1991
cshort at haywire.crl (Spmg*d, Lord of Potted Meat Product) writes:
>hi
>could someone show me some example code to take
>two char strings and combine them into another char
>string.
----------
int main() {
#include <stdio.h>
char *a = "first string",
*b = "second string",
c[128],
*d = c;
while (*a && *b)
*d++ = *a++ + *b++;
*d = '\0';
puts(c);
exit(0);
}
---------
How exactly did you want these strings combined?
--
Kenneth Herron kherron at ms.uky.edu
University of Kentucky +1 606 257 2975
Department of Mathematics "So this won't be a total loss, can you make
it so guys get to throw their mothers-in-law in?" "Sure, why not?"
More information about the Comp.lang.c
mailing list