以下程序的输出是【 】。 main() { char str1[]=How do you do",*p=strl; strcpy(str1+strlen(str1)\2"es she"); pfinff("

admin2010-09-05  37

问题 以下程序的输出是【  】。
main()
      {
      char str1[]=How do you do",*p=strl;
      strcpy(str1+strlen(str1)\2"es she");
      pfinff("%s\n",p1);
      }

选项

答案 How does she

解析 strcpy(strl,sl):字符串拷贝函数,作用是将字符串sl拷贝到字符数组strl中去。strlen(str):测试字符串str的长度,函数的值为字符串中实际长度,不包括‘\0’在内。本题中strlen(str l)的值为13,则strcpy(strl+strlen(strl)/2"es she")相当于strcpy(strl+6"es she");,因此可得答案为How does she。
转载请注明原文地址:https://kaotiyun.com/show/gdWp777K
0

最新回复(0)