From: "Robinson S." Newsgroups: comp.os.msdos.djgpp Subject: Re: Catenation (spelled right?) of strings Date: Fri, 13 Aug 1999 12:34:24 -0400 Organization: ICAN.Net Customer Lines: 33 Message-ID: <37B4490F.1EB@lords.com> References: <37B36D0D DOT 7F00 AT lords DOT com> <37B37890 DOT 2C249FED AT a DOT crl DOT com> NNTP-Posting-Host: dialin730.toronto.globalserve.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.04 (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Weiqi Gao wrote: > > "Robinson S." wrote: > > > > Is it possible to group a bunch of strings into an array of char: > > > > I tried this: > > char THE_STRING [255]; > > THE_STRING = "GOATS " + "MAKE " + "GOOD " + "PETS!"; > > > > My compiler (DGJPP gccw32.exe) says: "invalid operands to binary +" > > > > How do I join those strings? > > The correct thing to do is: > char *theString = "Goats " "make " "good " "pets!"; Great, that seems to work. But, it brings up some other questions: What if I want to add variables and strings to the char: --- char * ANIMAL = "Goats"; char *theString = ANIMAL "make " "good " "pets!"; --- How would that be accomplished? Also, can i modify *theString after having declared it as above, or has it become a constant? -- Robinson S., mailto:roby AT lords DOT com