首页/ 题库 / [单选题]设已执行预编译命令#include<st的答案

设已执行预编译命令#include<string.h>,以下程序段的输出结果是( )。 char s[]=" an apple" ; printf(" %d " ,strlen(s));

单选题
2022-06-20 22:17
A、7
B、8
C、9
D、10
查看答案

正确答案
B

试题解析
解析:如果一个字符数组中存放一个字符串,则函数strlen的值为“\0”之前的全部字符个数,也包括空格在内。注意:字符串处理函数的使用。

标签:
感兴趣题目
下面程序的输出结果为______。 #include<string.h> main() { char p1[7]="abc",p2[]="ABC",str[50]="xyz"; strcpy(str,strcat(p1,p2)); printf("%s",str); }
有以下程序:#include #include #include main(){ char*p1,*p2; p1=p2=(char*)malloc(sizeof(char)*10); strcpy(p1,malloc); strcpy(p2,p1+1); printf(%c%c, p1[0], p2[0]);}程序的运行结果是(  )。
有以下程序: main() { char s[]=" 123\"; printf("%d,%d ",strlen(s),sizeof(s)); } 执行后输出结果是( )。
有以下程序main(){ char s[]=" 123\";printf("%d,%d ",strlen(s),sizeof(s));}执行后输出结果是
有以下程序: main( ) { char s[]=" 123\"; printf( % d, % d ", strlen(s),sizeof(s)); }执行后的输出结果是 ______。
设已执行预编译命令#include<string.h>,以下程序段的输出结果是 char s[]=" an apple" ; printf("%d ",strlen(s));
设已执行预编译命令#include<string.h>,以下程序段的输出结果是( )。 char s[]=" an apple" ; printf(" %d " ,strlen(s));
下列程序的输出结果是( )。 #include<stdio.h> #include<string.h> main() { char a[]=" 123\"; printf("%d,%d ",strlen(a),sizeof(a)); }
有以下程序: #include <stdio.h> main( ) { char s[ ] ="159" , * p; p=s; printf( "% c", * p + + ); printf("%~", * p++);}程序运行后的输出结果是( )。
有以下程序: #include <stdio.h> #include <string.h> main() { char str[][20]={"Hello","Beijing"},*P=str[0]; printf("%d ",strlen(p+20)); } 程序运行后的输出结果是( )。
以下程序: #include<stdio.h> #include<string.h> main() {char str[]="abcd 123xab"; printf("%d",(str)); } 运行后的输出结果是( )。
有以下程序 #include <stdio.h> #include <string.h> void fun(char *s[],int n) { char *t; int i,j; for(i=0;i<n-1;++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i];s[j];s[j]=t;} } main() { char *ss[]={"bcc
相关题目
有以下程序: #include<string.h> main() { char str[][20]={"Hello","Beijing"),*p=str[0]; printf("%d ",strlen(p+20)); } 程序运行后的输出结果是( )。
有以下程序: # include<string.h> main() { char str[][20]={"Hello","Beijing"},*p=str; printf("%d ",strlen(p+20)); } 程序运行后的输出结果是 ______。
下面程序的输出结果是( )。 #include<iostream.h> #include"string.h" void main() {char a[]="Hello Test",b[]="Test"; strcpy(a,b); cout<<a<<end1; } A) B)C) D)
下列程序的输出结果是( )。 #include<iostream.h> #include"string.h" void main() {char a[]="Hello Test",b[]="Test"; strcpy(a,b); cout<<a<<end1; }
以下程序段的输出结果是 char s[]="\141141abc "; printf ("%d ",strlen(s));
以下程序段的输出结果是 char s[]=“\141141abc ”; printf(“%d ”,strlen(s));
有以下程序,程序运行的结果是 ______。 #include<iostream.h> #include<string.h> void main(){ char x[]= "C++" ,y[10]= "C++" ; cout<<sizeof(x)/sizeof(char)<<“,”<<sizeof(y)/sizeof(char); }
请读程序: # includde<stdio.h> # include<string.> void fun(char * s) {char a[10]; strcpy(a,"STRING"); s=a; } main() { char*p; fun(p); print{("%s ",p); } 上面程序的输出结果(表示空格) ( )
有以下程序 main() { char s[]=" 123\"; printf("%d,%d ",strlen(s),sizeof(s)); } 执行后输出结果是
有以下程序 main ( ){ char s[]=" 123\"; printf ( "%d, %d ", strlen (s) , sizeof (s));} 执行后输出结果是
当执行下面的程序时,如果输入ABC,输出结果是 ______。 #include<iostream.h> #include<string.h> void main(){ char ss[10]=“XYZWV”; cin>>ss; strcat(ss,”DEFG”); cout<<ss; }
当执行下面的程序时,如果输入ABC,则输出结果是______。 #include "stdio.h" #include "string.h" main() { char ss[10]="12345"; gets(ss);strcat(ss,"6789"); printf("%s ",ss); }
当执行下面的程序时,如果输入ABC,则输出结果是 ( ) # include<stdio.h> # include<string.h> main( ) { char ss [10] ="12345"; gets(ss);strcat(ss"6789");printf("%s ",ss); }
有以下程序:#include #include main(){ char a[20]=ab,b[20]=cdef; int k=0; strcat(a,b); while(a[k]!='\0') {  b[k]=a[k];  k++; } puts(b);}程序的运行结果是(  )。
有以下程序:#include#includemain(){ char w[20],a[5][10]={abcdef,ghijkl,mnopq,rstuv,wxyz.}; int i; for(i=0;i<5;i++)w[i]=a[i][strlen(a[i])-1]; w[5]='\0'; puts(w);}程序的运行结果是(  )。
有以下程序 #include <stdio.h> #include <string.h> void fun(char,*s[],int n) { char *t; int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;} } main() { char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5); printf("%s,%s ",ss[0],ss[4]); } 程序的运行结果是
有以下程序: #include<stdio.h> #include<string.h> void fun(char*s[],int n) { char*t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])){t=s[i];s[i]=s[j];s[j]=t;} } main() { Char*ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s ",ss[0],ss[4]); } 程序的运行结果是( )。
有以下程序: #include <stdio.h> main( ) { chars[] ="Yes /No",*ps=s; puts(ps +4); * (pa +4) =0; puts(s); }程序运行后的输出结果是( )。
阅读下列程序,则在执行后,程序的运行结果为 #include"stdio.h" #include"string.h" main() { char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s ",a);}
当执行下面的程序时,如果输入ABC,则输出结果是( )。#include<stdio.h>#include<string.h>void main(){char ss[10]="12345",gets(ss);strcat(ss,"6789");printf("%s\n",ss);}A.ABC6789 B.ABC67 C.12345ABC6 D.ABC456789
广告位招租WX:84302438

免费的网站请分享给朋友吧