// 完成字符数组s1[]和字符串常量s2的串接,类似于string.h中的char *strcat()
#include
void main() {
char *s,s1[20] = "Here is",*s2 = " the key.";
s = s1;// 首先使指针s指向s1的第一个字符'H'
while(*s != '\0') s++; // 顺序移动指针,直到s指向s1[]的串结束符'\0'
while(*s++ = *s2++); // 复制s2的内容到s1,包括串结束符'\0'
printf("%s\n",s1); // 输出串接后的内容。
}