Download TMS320C55x Optimizing C/C++ Compiler User's Guide

Transcript
strncat
Example
In the following example, the character strings pointed to by *a, *b, and *c were
assigned the values shown in the comments. In the comments, the notation
\0 represents the null character:
char *a, *b, *c;
size_t size = 13;
.
.
.
/* a––> ”I do not like them,\0”
*/;
/* b––> ” Sam I am, \0”
*/;
/* c––> ”I do not like green eggs and ham\0” */;
strncat (a,b,size);
/* a––> ”I do not like them, Sam I am, \0”
*/;
/* b––> ” Sam I am, \0”
*/;
/* c––> ”I do not like green eggs and ham\0” */;
strncat (a,c,size);
/* a––> ”I do not like them, Sam I am, I do not like\0”
/* b––> ” Sam I am, \0”
/* c––> ”I do not like green eggs and ham\0”
7-84
*/;
*/;
*/;