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

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

分析下面的程序,指出程序中的错误: # include <stdio.h> int main(void) { char a; char *str=&a; strcpy(str,"hello"); printf("%sn",str); return 0; }


参考答案和解析
342错了,字节数据最大是255
更多 “分析下面的程序,指出程序中的错误: # include <stdio.h> int main(void) { char a; char *str=a; strcpy(str,"hello"); printf("%sn",str); return 0; }” 相关考题
考题 下列程序的运行结果为includevoid abc(char*str){int a,b;for(a=b=0;str[a]!='\0';a++ 下列程序的运行结果为 #include<stdio.h> void abc(char*str) { int a,b; for(a=b=0;str[a]!='\0';a++) if(str[a]!='c') str[b++]=str[a]; str[b]='\0';} void main() { char str[]="abcdef"; abc(str); printf("str[])=%s",str);}A.str[]=abdefB.str[]=abcdefC.str[]=aD.str[]=ab

考题 下列程序的运行结果为()。 include voidabc(Char*str) {inta,b,i,j; for(i=j=0;str[i]! 下列程序的运行结果为( )。#include<stdio.h>voidabc(Char*str){ inta,b,i,j;for(i=j=0;str[i]!='\0';i++)if(str[i]!='a')str[j++]=str[i];str[j]='\0';}void main(){ char str[]="abcdef";abc(str);printf("str[]=%s",str);}A.str[]=bcdefB.str[]=abcdefC.str[]=aD.str[]=ab

考题 下列程序的运行结果为()。includevoidabc(char*str){int a,b,i,j;for(i=j=0;str[i]!='\ 下列程序的运行结果为( )。#include<stdio.h>voidabc(char*str){int a,b,i,j;for(i=j=0;str[i]!='\0';i++)if(str[i]!='a')str[j++]=str[j];str[j]='\0';}void main(){char Str[]="abcdef';abc(str);printf("str[]=%s",str);}A.str[]=bcdefB.str[]=abcdefC.str[]=aD.str[]=ab

考题 有以下程序:includeincludeusingnameSpacestd;classperson{ intage; Char*nam 有以下程序:include <iostream>include <string>using nameSpace std;class person{int age;Char * name;public:person ( int i, Char * str ){int j;j = strlen( str ) + 1;name = new char[ j ];strcpy( name, str );age = i;}~person(){delete name;cout<<"D";}void display(){cout<<name<<":"<<age;}};int main(){person demo( 30,"Smith" );demo.display();return 0;}则该程序的输出结果为:【 】。

考题 以下C程序段的输出结果是(30)。 include void abc(char *str){ int a, b; 以下C程序段的输出结果是(30)。 #include <stdio. h> void abc(char *str){ int a, b; for(a=b=0;str[a]!='\O';a++)if(str[a]!='c') str[b++]=str[a]; str[b]='\O'; } void main(){ char str[]="abcdef"; abc(str); printf("str[]=%s",str); }A.str[]=aB.str[]=abC.str[]=abdefD.str[]=abcdef

考题 对于下面的程序includeincludechar *scmp(char*s1,char*s2){if(strcmp(s1, 对于下面的程序 #include<stdio.h> #include<string.h> char *scmp(char*s1,char*s2) { if(strcmp(s1,s2)<0)return(s1); else return(s2); } main() { int i:char string[20],sb[3][20]; for(i=0;i<3;i++)gets(str[i]); strcpy(string,scmp(str[0],str[1])); strcpy(string,scmp(string,str[21)); printf("%s\n",string); } 若运行时依次输入abcd、abba和abc三个字符串,则输出结果为______。A.abcdB.abbaC.abcD.abca

考题 下列程序的运行结果为()。includevoid abc(char*str){int a,b,i,j; for(i=j=0;str[i]!= 下列程序的运行结果为( )。 #include<stdio.h> void abc(char*str) { int a,b,i,j; for(i=j=0;str[i]!='\0';i++) if(str[i]!='a' str[j++]=str[i]; str[j]='\0'; } void main() { char str[]="abcdef"; abc(str); printf("str[]=%s",str); }A.str[]=bcdefB.str[]=abcdefC.str[]=aD.str[]=ab

考题 有以下程序:includemain(){ char str[][20]={"Hello","Beijing"),*p=str[0];printf(" 有以下程序: #include<string.h> main() { char str[][20]={"Hello","Beijing"),*p=str[0]; printf("%d\n",strlen(p+20)); } 程序运行后的输出结果是( )。A.0B.5C.7D.20

考题 下列程序段的运行结果是()。includevoid main(){char str[]="ABC",*p=str;printf("%d\n 下列程序段的运行结果是( )。 #include<stdio.h> void main() { char str[]="ABC",*p=str; printf("%d\n",*(p+3)); }A.67B.0C.字符'C'的地址D.字符'C'

考题 下列程序段的运行结果是()。 include void main() {char str[]="ABC",*p=str; printf(" 下列程序段的运行结果是( )。#include<stdio.h>void main(){ char str[]="ABC",*p=str;printf("%d\n",*(p+3) );}A.67B.0C.字符'C'的地址D.字符'C'

考题 对于下面的程序includeincludechar * scmp(char * s1,char * s2){if(strcm 对于下面的程序 #include<stdio.h> #include<string.h> char * scmp(char * s1,char * s2) { if(strcmp(s1,s2)<0)return(s1); else return(s2); } main() { int i;char string[20],str[3][20]; for(i=0;i<3;i++)gets(str[i]); strcpy(string,scmp(str[0],str[1])); strcpy(string,scmp(string,str[2])); printf("%s\n",string); } 若运行时依次输入abcd、abba和abc三个字符串,则输出结果为 ______。A.abcdB.abbaC.abcD.abca

考题 下列程序的运行结果为()。 include voidabc(char*str) {int a,b,i,j; for(i=j=0;str[i] 下列程序的运行结果为( )。#include<stdio.h>voidabc(char*str){int a,b,i,j;for(i=j=0;str[i]!='\0';i++)if(str[i]!='a')str[j++]=str[j];str[j]='\0';}void main(){char Str[]="abcdef';abc(str);printf("str[]=%s",str);}A.str[]=bcdefB.str[]=abcdefC.str[]=aD.str[]=ab

考题 以下程序的输出结果是【 】。includeincludechar*fun(char*0{ char *p--t;retur 以下程序的输出结果是【 】。include <stdio.h>include <string.h>char *fun(char *0{ char *p--t;return (p+strlen(t)/2);}main(){ char *str="abcdefgh";str=ftm(str);puts(str);}

考题 下列程序的输出结果是【】。 include include using namespace std; void fun(c 下列程序的输出结果是【 】。include<iostream>include<cstring>using namespace std;void fun(const char *s,char c){c=s[strlen(s)/2];}int main(){char str[]="ABCDE";char ch=str[1];fun(str,ch);cout<<ch;return 0;}

考题 若有以下程序: include using namespace std; int main() {char str[10];cin>>str;co 若有以下程序:include <iostream>using namespace std;int main(){char str[10];cin>>str;cout<< str<<end1;return 0;}当输入为:This is a program!那么执行程序后的输出结果是【 】。

考题 以下程序运行后的输出结果是______。includeinclude usingnamespacestd;classY 以下程序运行后的输出结果是______。include <iostream>include <string>using namespace std;class Y;class X{int x;char *strx;public:X(int a, char *str){x=a;strx=new char[strlen(str)+1]strcpy (strx,str);}void show(Y ob);};class Y{prlvate:int y;char *stry;public:Y(int b,char *str){y=b;stry=new char[strlen(str)+1];strcpy(stry,str);}friend void X::show(Y ob);};void X::show{Y ob){cout<<strx<<",",cout<<ob.stry<<endl;}int main{{X a (10, "stringX");Y b (20, "stringY");a. show (b);renurn 0;}

考题 下列程序的输出结果是______。includeinclude using namespace std;void 下列程序的输出结果是______。include <iostream.h>include <cstring.h>using namespace std;void fun(const char*s,char C) {c=s[strlen (s)/2];}int main {){char str [] ="ABCDE";char ch=str[1];fun(str,sh);cout<<Ch;return 0;}

考题 void setmemory(char **p, int num){ *p=(char *) malloc(num);}void test(void){ char *str=NULL;getmemory(str,100);strcpy(str,"hello");printf(str);}运行test函数有什么结果?( )

考题 阅读下列程序,写出程序的运行结果【】。 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;}

考题 Void GetMemory2(char **p, int num){*p = (char *)malloc(num);}voidTest(void){char *str = NULL;GetMemory(str, 100);strcpy(str, "hello"); printf(str); }请问运行Test 函数会有什么样的结果?

考题 void Test(void){char *str = (char *)malloc(100); strcpy(str, “hello”); free(str); if(str != NULL) { strcpy(str, “world”); printf(str);}}请问运行 Test 函数会有什么样的结果?

考题 下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?①void GetMemory(char * p){p = (char * )malloc(100);}void TestMemory (void){char *str = NULL;GetMemory (str);strcpy(str, "hello world");prinff(str);}② char * GetMemory (void){char p[ ] = "hello world";return p;}void TestMemory (void){char * str = NULL;str = GetMemory( );printf(str);}③void GetMemory(char * * p, int num){* p = (char * )malloc(num);}void TestMemory (void){char * str = NULL;GetMemory(str, 100);strcpy( str, "hello" );printf(sir);}④void TestMemory (void){char *str = (char * )malloe(100);strepy (str, "hello" );free ( str );if(str ! = NULL){strepy( str, "world" );printf(str);}}

考题 下列程序段的运行结果是()。includevoid main(){ char str[]="ABC",*p=str;printf("%d\ 下列程序段的运行结果是( )。#include<stdio.h>void main(){ char str[]="ABC",*p=str; printf("%d\n",*(p+3));}A.67B.0C.字符'C'的地址D.字符'C'

考题 有以下程序:include include using namespace std;class Y;class X{private 有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X { private: int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); } void show(Y ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); } friend void X: :show(Y ob) ; }; void X: :show(Y ob) { cout<<strx<<", "; cout<<ob, stry<<end1; } int main ( ) { X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; } 执行后的输出结果是( )。A.X,YB.a,bC.X,XD.Y,Y

考题 下列程序的运行结果为includevold abc(char*str){int a,b; for(a=b=0;str[a]!='\0';a+ 下列程序的运行结果为 #include<stdio.h> vold abc(char*str) { int a,b; for(a=b=0;str[a]! ='\0';a++) if(str[a]!='c') str[b++]=str[a]; str[b]='\0';} void main() { char str[]="abcdef"; abc(str); printf("str[]=%s",str);}A.str[]=abdefB.str[]=abcdefC.str[]=aD.str[]=ab

考题 有以下程序:includeincludemain(){char str[][20]={"Hello","Beijing"},*P 有以下程序: #include <stdio.h> #include <string.h> main() { char str[][20]={"Hello","Beijing"},*P=str[0]; printf("%d\n",strlen(p+20)); } 程序运行后的输出结果是( )。A.0B.5C.7D.20

考题 下列程序的输出结果是______。 include int CalcDigital(char*str) { if(str= =NULL) 下列程序的输出结果是______。include<iostream.h>int CalcDigital(char*str){if(str= =NULL)return 0;int num_of_digital=0;for(int i=0;str{i]!=0x0;i++)if(str[i]<='9' str[i]>='0')num_of_digital++;return num_of_digital;}void main( ){char a[]="Beijing20080lympic";cout<<CalcDigital(a)<<endl;}

考题 单选题有如下程序:#include int disp(char *str){ while(*str) putchar(*str++); return *str;}main(){ printf(%d,disp(NAME));}程序运行后的输出结果是(  )。A NAME0B NAMEEC NAMED NAME\0