Newsgroups: comp.lang.c
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!ukma!kherron
From: kherron@ms.uky.edu (Kenneth Herron)
Subject: Re: help with strcat
Message-ID: <1991Jun4.213935.5508@ms.uky.edu>
Organization: University Of Kentucky, Dept. of Math Sciences
References: <CSHORT.91Jun4131435@haywire.crl>
Distribution: comp
Date: Tue, 4 Jun 1991 21:39:35 GMT
Lines: 33

cshort@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@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?"
