Strcat函数原型如下(以下代码为错误代码,想要通过char *指针修改
字符串常量中的字符会导致Segment fault错误):
strcat 即 Strings Catenate,横向连接
字符串。
将
数组 s1,s2,...,sN 水平地连接成单个字符串,并保存于变量 combinedStr中。如果任一参数是
元胞数组,那么结果 combinedStr 是一个元胞数组,否则,combinedStr是一个字符数组。
For character array inputs, strcat removes trailing ASCII
white-spacecharacters: space, tab, vertical tab, newline, carriage return, and form-feed. To preserve trailing spaces when concatenating character arrays, use horizontal array concatenation, [s1, s2, ..., sN]. See the final example in the following section.
For cell array inputs, strcat does not remove trailing white space.
When combining nonscalar cell arrays and multi-row character arrays, cell arrays must be column vectors with the same number of rows as the character arrays.