CompuServe Messages

Strings in C

    04-Jan-95 20:55:25
Sb: #44803-Strings in C
Fm: Doug Walker 71165,2274
To: Shraddhan 70374,754
Thanks – glad I could be of help. I don't know what books you are using, but string concatenation was an extension added by the ANSI committee and wasn't present in K&R. If you're using older books, it might not be mentioned (or maybe they were just too lazy to revise the example…) At the same time as string concatenation, the ANSI committee added "token pasting" and "stringization" operators to preprocessor macros. They work like this: #define FOO(x) abc##x #define STR(x) #x The macro invocation FOO(xyz) expands to abcxyz and the macro invocation STR(xyz) expands to "xyz". These are pretty useful in certain specific cases. –Doug