Can i do this:
AString = (String1 + "and" + String2);
??
Or is there an other way?
Thanks
Can i do this:
AString = (String1 + "and" + String2);
??
Or is there an other way?
Thanks
You can't write it that way in C. C has a very basic concept of string type, and almost every manipulation on a string requires a function call. In this case, you need strcat() to "concatenate" two strings.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Not in C. To add strings together use strcat, and remember that you need to set enough space aside to hold the resulting string. Example:
Code:#include <stdio.h> #include <string.h> // for strcat int main() { char result[255] = {""}; char a[] = "String1"; char b[] = "String2"; strcat(result, a); strcat(result, " and "); strcat(result, b); printf("%s", result); getchar(); }