[单选题]

有以下程序

#include<string.h>

main()

{ char p[]={′a′, ′b′, ′c′},q[10]={ ′a′, ′b′, ′c′};

printf("%d%d/n",strlen(p),strlen(q));}

以下叙述中正确的是

A.在给p和q数组置初值时,系统会自动添加字符串结束符,故输出的长度都为3

B.由于p数组中没有字符串结束符,长度不能确定,但q数组中字符串长度为3

C.由于q数组中没有字符串结束符,长度不能确定,但p数组中字符串长度为3

D.由于p和q数组中都没有字符串结束符,故长度都不能确定

参考答案与解析:

相关试题

有以下程序 #include<string.h> main() {char p[

[单选题]有以下程序#include<string.h>main(){ char p[]={′a′, ′b′, ′c′},q[10]={ ′a′, ′b′, ′c′};printf("%d%d/n",strlen(p),strlen(q));}以下叙述中正确的是A.在给p和q数组置初值时,系统会自动添加字符串结束符,故输出的长度都为3B.由于p数组中没有字符串结束符,长度不能确定,但q数组中字符串长度为3C.由于q数组中没有字符串结束符,长度不能确定,但p数组中字符串长度为3D.由于p和q

  • 查看答案
  • 有以下程序#include <string.h>main( ){ char p[

    [单选题]有以下程序#include <string.h>main( ){ char p[20]={ 'a', 'b', 'c', 'd'},q[]="abc", r[]="abcde"strcat(p,r); s trcpy(p+strlen(q),q);p rintf("%d/n", strlen (p));}程序运行后的输出结果是A.)9B.)6C.)11D.)7

  • 查看答案
  • 有以下程序#include <string.h>main( ){ char p[

    [单选题]有以下程序#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/n",sizeof(p),strlen(p));}程序运行后的输出结果是A.)20 9B.)9 9C.)20 11D.)11 11

  • 查看答案
  • 有以下程序 # include <string.h> main() {char

    [单选题]有以下程序# include <string.h>main(){char p[20]={′a′, ′b′, ′c′, ′d′}, q[]="abc", r[]="abcde";strcat(p, r); strcpy(p+strlen(q), q);printf("%d/n",strlen(p));}程序运行后的输出结果是A.9B.6C.11D.7

  • 查看答案
  • 有以下程序 # include <string.h> main() {char

    [单选题]有以下程序# include <string.h>main(){char p[20]={′a′, ′b′, ′c′, ′d′}, q[]="abc", r[]="abcde";strcat(p, r); strcpy(p+strlen(q), q);printf("%d/n",strlen(p));}程序运行后的输出结果是A.9B.6C.11D.7

  • 查看答案
  • 有以下程序:include<stdio.h> include<string.h>

    [单选题]有以下程序:include<stdio.h> include<string.h>main{ char x[]="STRING"有以下程序:include<stdio.h>include<string.h>main{ char x[]="STRING";x[0]=0;x[1]=/0;x[2]=0;printf("%d %d/n",sizeof(x),strlen(x));}程序运行后的输出结果

  • 查看答案
  • 有以下程序#include<stdio.h>#include<string.h>

    [单选题]有以下程序#include<stdio.h>#include<string.h>struet A{int a;char b[10];double c;};struct A f(struct A t);main( ){struct A a={1001,“ZhangDa”,1098.0);a=f(A);prinff(“%d,%S,%6.1f\n”,a.a,a.b,a.e);}struct A f(struct A t){t.a=1002;strepy(t.b,“changRo

  • 查看答案
  • 有以下程序#include<stdio.h>#include<string.h>

    [单选题]有以下程序#include<stdio.h>#include<string.h>main( ){char a[10]=”abcd”;prinff(“%d,%d\n”,strlen(A),sizeof(A));}程序运行后的输出结果是A.7,4B.4,10C.8,8D.10,lO

  • 查看答案
  • 有以下程序#include<stdio.h>#include<string.h>

    [单选题]有以下程序#include<stdio.h>#include<string.h>main( ){char str[][20]={“Qne*World”,“one*Dream!”},*P=str[1 ].prinff(“%d,”,strlen(p));printf(“%s\n”,P); ’}程序运行后的输出结果是A.9,One*World S)9,One*Dream!B.10,One*Dream!C.10,One*World

  • 查看答案
  • 有以下程序#include<stdio.h>#include<string.h>

    [单选题]有以下程序#include<stdio.h>#include<string.h>main( ){char x[]=“STRING”;x[0]=0;x[1]=’\0’;x[2]=’0’;printf(”%d%d\n”,sizeof(x),strlen(x));}程序运行后的输出结果是( )。A.6 1B.7 0C.6 3D.7 1

  • 查看答案