知识点:
- strlen()函数所计算的字符串长度不包括"\0"
- 指针在移动时不会跳过空格
如下题所示:
#include<stdio.h>
#include<string.h>
char *a="you";
char *b="Welcome you to Beijing!";
main()
{
char*p;
p=b;
while(*p!=*a)p++;
p+=strlen(a)+1;
printf("%s\n",p);
}
由知识点可知,程序运行后的输出结果为:to Beijing!