For example if I have one char variable "coo" and the other "kie", how can I put them together to one variable without making them to strings?
For example if I have one char variable "coo" and the other "kie", how can I put them together to one variable without making them to strings?
well, "coo" isn't a char variable, it's a char array, which is a string. So if what you mean is that you don't want to put them into an std::string object, then you can do something like this:
char *c = "coo";
char *k = "kie";
char *ck = new char[strlen(c) + strlen(k) + 1];
sprintf(ck, "%s%s", c, k);
I ment more like this
char first[500]="coo";
char second[500]="kie";
char thisshouldbewhereiwanttoaddthemtogether[500];
maybe this way
KurtCode:strcpy( thisshouldbewhereiwanttoaddthemtogether, first); strcat( thisshouldbewhereiwanttoaddthemtogether, second);