网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

若有语句;char str1[8],str2[8]={"hello!"}; 则能将字符串hello!赋给str1的正确语句是_____

A.str1=str2

B.strcpy(str1,str2)

C.str1==str2

D.strcpy(str2,str1)


参考答案和解析
’/0’
更多 “若有语句;char str1[8],str2[8]={"hello!"}; 则能将字符串hello!赋给str1的正确语句是_____A.str1=str2B.strcpy(str1,str2)C.str1==str2D.strcpy(str2,str1)” 相关考题
考题 执行语句序列char strl[10]="ABCD",str2[10]="XYZxyz";for (int i=0; strl[i]=str2[i]; i++)后,数组str1中的字符是XYZxyz,数组str2中的字符串是【 】。

考题 执行语句序列char str1[10]="ABCD",str2[10]="XYZxyz";for(int i=0;strl[i]=str2[i];i++);后,数组strl中的字符串是______。

考题 设有语句:char str1[]="string",str2[8],*str3,*str4="string";,则下列对库函数strcpy调用不正确的是A.strcpy(str1,"Hello1");B.strcpy(str2,"Hello2");C.strcpy(str3,"Hello3");D.strcpy(str4,"Hell04");

考题 阅读下列函数说明和C函数,将应填入(n)处的字句写在对应栏内。[函数2.1说明]函数strcpy的功能是将字符串str2的内容复制到字符申str1。[函数2.1](1) strcpy (char *slr1, const char *str2){ char * temp;while( * str2!='\0') *cp++ =(2);(3)='\0';return str1;}[函数2.2说明]函数int strcmp(const char *str1, const char *str2)的功能是按字典序比较两个字符串str1和str2的大小。当str1<str2时返回-1,当str1>str2时返回1,否则返回0。[函数2.2]int strcmp(const char *str1, const char *str2){ while( *str1= =* str2) {if(* s1= =(4)) return 0;s1++;(5);}if( *str1<*str2) return -1;return 1;}

考题 设有以下语句: char str1[]="string",str2[8],*str3,*str4=="string; 则______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4")

考题 请补充函数fun(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。例如:str1=“How do”,str2=“you do?”,结果输出: How do you do?注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define N 40void fun(char*str1,char *str2){int i=0;char *pl=str1;char*p2=str2;while(【 】)i++;for(;【 】;i++)*(p1+i)=【 】;*(p1+i)='\0';}main(){char str1[N],str2[N);clrscr();printf("*****Input the string str1 Str2*****\n");printf("\nstr1:");gets(str1);printf("\nstr2:");gets(str2);printf("**The string str1 str2**\n");puts(str1);puts(str2);fun(str1,str2);printf("*****The new string *****\n");puts(str1);}

考题 设有以下语句: char str1 []="string"mstr2 [8],*str3,*str4=="string"; 则 ______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str 4,"HELLO4");

考题 设有以下语句: char str 1[]="string",str2[8],*str3,*str4="string"; 则______不是对库函数的正确调用。A.strcpy(str 1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4");

考题 不能把字符串"Hello!"赋给数组b的语句是______。A.char b[10]={'H', 'e',' l',' l', 'o','!'};B.char b[10]={'h', 'e', 'l', 'l', 'o','!'};C.char b[10];strcpy (b, "Hello!"};D.char b[10]="Hello!";

考题 设有以下语句: char strl[]="string",str2[8],*str3,*str4="string"; 则_______不是对库函数的正确调用。A.strcpy(strl,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4");

考题 语句定义如下: char strl[50],str2[20],ch; 则下列语句正确的是______。A.str1={"Crazy"}; str2=str1;B.str1={"Crazy"}; str2={"English"}; strcpy(str1,str2);C.ch="xy";D.ch='x';

考题 不能把字符串:Hello!赋给数组b的语句是( )。A.char b[10]={’H’,’e’,’l’,’l’,’o’,’!’};B.char b[10]; b="Hello!";C.char b[10]; strcpy(b,"Hello!");D.char b[10]="Hello!";

考题 阅读下列程序,写出程序的运行结果【】。 include void main() { charstr1[ ]: "Hello, 阅读下列程序,写出程序的运行结果【 】。include<iostream. h>void main() { char str1[ ]: "Hello, World?;char str2[100];int i=0;do{if (str1[i]>= 'a' str1[i]<= 'z' )str2[i]=str1[i]-32;elsestr2[i]=strl [i];i++;}while(strl[i]!='\0');str2[i]='\0';cout<<str1<<end1;cout<<str2<<end1;}

考题 设有语句:char str1[]="string", str2[8], *ste3, *str4="string";,则下列不是对库函数 strcpy的正确调用的是______。A.strcpy(str1,"HELLOI");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLOY");D.strcpy(str4,"HELLO4");

考题 设有语句:char str1[]="string",str2[8],*str3,*str4="string";,则下列对库函数strcpy调用不正确的是A.strcpy (str1,"Hello1");B.strcpy(str2, "Hello2");C.strcpy(str3, "Hell03");D.strcpy(str4, "Hell04");

考题 下列语句中,正确的是______。A.static char str[]="China";B.static char str[];str="China";C.static char str1[5],str2[]={"China"};strl=str2;D.static char str1[],str2[];str2={"China"};strcpy(str1,str2);

考题 以下选项中,属于合法语句的是( )。A.char nm[10]; nm="C Program";B.char str1[10]="computer",str2[10]; str2=str1;C.char str[7]="siring!";D.char sp[]="Hello!";

考题 在下列语句中,正确的是( )A.static char str[]="China";B.static char str[];str="China";C.static char str1[5],str2[]={"China"};str1=str2;D.static char str1[],str2[];str2={"China"};strcpy(str1,str2);

考题 设char str1[11]="HELLO,",str2[10]=“world”;则执行语句cout 设char str1[11]="HELLO,",str2[10]=“world”;则执行语句 cout<<strlen(strcpy(str1,str2)));后的输出结果是 ______。A.12B.11C.7D.5

考题 不能把字符串“Hello!”赋给数组b的语句是________。A.char b[10]={'H','e','1','l','o','!'};B.chsr b[10]={'h','e','1','1','o','!'};C.char b[10];strcpy(b,"Hello!");D.chgr b[10]="Hello!";

考题 设有以下语句: char str1[]="string",str2[8],*str3,*str4="str4="string"; 则______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2."HELLO2");C.strcpy(str3."HELLO3");D.strcpy(str4."HELLO4");

考题 设有以下语句:  char str1[]= “string”,str2[8],*str3,*str4= “ string”;      则不能对库函数strcpy(复制字符串)的正确调用的是()A、strepy(str1,“HELLO1”);B、strepy(str2,“HELL02”);C、strcpy(str3, “HELL03”)D、strcpy(str4, “HELLO4”);

考题 设有两字符串“Good”、“Morning”分别存放在字符数组str1[10]、str2[10]中,下面语句中能把“Morning”连接到“Good”之后的是()A、strcpy(str1,str2)B、strcpy(str1,"Morning")C、strcat(str1,"Morning")D、strcat("Good",str2)

考题 不能把字符串“Hello!”赋给数组b的语句是()A、char b[10]={’H’,’e’,’l’,’l’,’o’,’!’};B、char b[10];b="Hello!";C、char b[10];strcpy(b,"Hello!");D、char b[10]="Hello!";

考题 设已定义:char str1[10],str2[10]=”Fujian”;则能将字符串”Fujian”赋给数组str1的正确语句是()A、str1=”Fujian”B、strcpy(str1,str2)C、strcpy(str2,str1)D、str1=str2

考题 单选题以下涉及字符串数组、字符指针的程序段,不会产生编译错误的是(  )。A char*str,name[10]; str=Hello World;B char*str,name[10]; name=Hello World;C char str1[10]=prog.c, str2[10]; str2=str1;D char head_line[]; head_line=== == == == == == =;

考题 单选题设已定义:char str1[10],str2[10]=”Fujian”;则能将字符串”Fujian”赋给数组str1的正确语句是()A str1=”Fujian”B strcpy(str1,str2)C strcpy(str2,str1)D str1=str2

考题 单选题若有定义语句:char str1[] = "string", str2[8], *str3, str4[10] = "string";库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是(  )。A strcpy(str3, "HELLO!");B strcpy(str2, "HELLO!");C strcpy(str1, "HELLO!");D strcpy(str4, "HELLO!");