Mail Archives: djgpp/1999/08/13/13:26:16
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
- Raw text -