当前位置: 首页 > 计算机 > 问题详情
问题

设有static char str[]="Beijing";则执行printf("%d\n" strlen(strcpy(str "China")));后的输出

设有 static char str[]="Beijing"; 则执行 printf("%d\n",strlen(strcpy(str,"China"))); 后的输出结果为_______。

A.5

B.7

C.12

D.14

发布时间:2024-05-07
参考答案

正确答案:A
解析:在执行printf()函数前,数组str的长度是7,但是当使用strcpy()函数将新的值赋给str后,strlen()函数返回的应当是现在的str字符串的字符个数,即是5。

相关问题
  • 如果String s1=“Chongqing” 则运行代码String s3=s1.substring(2 4)后s3的值为()

    如果String s1=“Chongqing”,则运行代码String s3=s1 substring(2,4)后s3的值为() A、honB、hoC、onD、ngq

    答案解析
  • You are the database administrator for a financial services company. Employees enter data

    You are the database administrator for a financial services company Employees enter data 24 hours a day into a SQL Server

    答案解析
  • You are the database administrator for a retail company. The company owns 270 stores. Ever

    You are the database administrator for a retail company The company owns 270 stores Every month, each store submits approx

    答案解析
  • You are the administrator of several SQL Server 2000 computers. A data Transformation Serv

    You are the administrator of several SQL Server 2000 computers A data Transformation Services (DTS) package uses native OLE

    答案解析
  • You are the administrator of Ezonexam's network.

    You are the administrator of Ezonexam"s network You want to deploy a Windows 2000 Professional service pack to 10 computers

    答案解析
  • You are the administrator of a Windows 2000 network. You need to store secured files for y

    You are the administrator of a Windows 2000 network You need to store secured files for your company"s accounting and lega

    答案解析
  • You are the desktop administrator for Ezonexam Inc.

    You are the desktop administrator for Ezonexam, Inc The company"s network contains an intranet Web farm, which consists of

    答案解析
  • You are the administrator of a Windows 2000 Professional computer that has a shared printe

    You are the administrator of a Windows 2000 Professional computer that has a shared printer Several departments in your com

    答案解析
  • 有以下程序#include <string.h>main( int argc char *arg

    有以下程序 include <string h>main( int argc, char *argv[ ]){ int i=1,n=0;while (i< argc) {n=n+strIen ( angv[i ] ) ;i++; }pri

    答案解析
  • 有以下程序#include <string.h>main( ){ char p[20]={&#x27;

    有以下程序 include <string h>main( ){ char p[20]={"a","b","c","d"},q[]="abc", r[]="abcde";strcpy(p+strlen(q),r); strcat(p,q);printf("%d%d

    答案解析

最新问题

Copyright © 2016-2023 114题库网(114158.com)All Rights Reserved.  免责声明 豫ICP备19007809号-5