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

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

设有如下函数定义,则输出结果为_______。 char*fun(char*str) { char*p=str; while(*p) {if(*p>'d')continue; p++; } return p; } main() { printf("%s\n",fun("welcome!")); }

A.welcome

B.come!

C.w

D.程序进入死循环


参考答案

更多 “ 设有如下函数定义,则输出结果为_______。 char*fun(char*str) { char*p=str; while(*p) {if(*p>'d')continue; p++; } return p; } main() { printf("%s\n",fun("welcome!")); }A.welcomeB.come!C.wD.程序进入死循环 ” 相关考题
考题 以下函数 fun 的功能是返回 str 所指字符串中以形参 c 中字符开头的后续字符串的首地址 , 例如 : st r所指字符串为 : Hello! , c 中的字符为 e ,则函数返回字符串 : ello! 的首地址。若 str 所指字符串为空串或不包含 c 中的字符,则函数返回 NULL 。请填空。char *fun(char *str,char c){ int n=0; char *p=str;if(p!=NULL)while(p[n]!=cp[n]!='\0') n++;if(p[n]=='\0') return NULL;return( 【 1 2 】 );}

考题 以下程序的输出结果是 _[13]_______ .#include stdio.h#include string.hchar *fun(char *t){ char *p=t;return(p+strlen(t)/2);}main(){ char *str="abcdefgh";str=fun(str);puts(str);}

考题 请补充函数fun(),该函数的功能是:依次取出字符串中所有的小写字母以形成新的字符串,并取代原字符串。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>void fun(char *s){int i=0;char *p=s;while(【 】){if (*p>='a'*p<='z'){s[i]=*p;【 】;}p++;}s[i]=【 】;}main(){char str[80];clrscr();printf("\nEnter a string:");gets(str);printf("\n\nThe string is:\%s\n",str);fun(str);printf("\n\nThe string of changingis:\%s\n",str);}

考题 下列程序运行后,如果从键盘上输入ABCDE,则输出结果为______。includeinclude 下列程序运行后,如果从键盘上输入ABCDE<回车>,则输出结果为______。 #include<stdio.h> #include<string.h> fuch (char str[] ) { int num=0; while (*(str+num)!='\0')num++; return(num); } main() { char str[10],*p=str; gets(p);printf("%d\n",fuch(p)); }A.8B.7C.6D.5

考题 请补充函数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);}

考题 请补充函数fun,该函数的功能是比较字符串str1和str2的大小,井返回比较的结果。例如: 当str1=“cdef",str2=“cde”时,函数fun()返回“>”。注意:部分源程序给出如下。请勿改动主函数main 和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include< stdio, h>include<conio. h>define N 80char *fun (char *str1,char *str2){char *p1=str1, *p2=str2;while (*p1 *p2 ){if (【 】)return "<";if(【 】)return ">";p1++;p2++;}if (*p1=*p2)return "==";if (*p1==【 】)return "<";elsereturn ">";}main(){char str1 [N], str2 [N];clrscr ();printf ("Input str1: \n");gets (str1);printf ("Input str2: \n");gets (str2);printf ("\n*****the result*****\n");printf ("\nstr1 %s str2", fun (str1, str2) );}

考题 以下程序运行后的输出结果是( )。includechar*ss(char*s){char*p,t;P=s+1;t=*s;while(*p){ *(P-1)=*P;P++;}*(P-1)=t;return s;}main(){char*p,str[10]="abcdefgh";p=ss(str);printf("%s\n",p);}

考题 请补充函数fun(),该函数的功能是判断一个数是否为回文数。当字符串是回文时,函数返回字符申:yes!,否则函数返回字符串:no!,并在主函数中输出。所谓回文即正向与反向的拼写都一样,例如:abcba。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<string.h>include<stdio.h>char *fun(char*str){char *p1,*p2;int i, t=0;p1=str;p2=str+strlen(str)-1;for (i=0;【 】;i++)if(【 】){t=1;break;}if (【 】)return("yes!");elsereturn("no!");}main(){char str[50];printf("Input;");scanf("%s",str);printf("%s\n",fun(str));}

考题 以下程序运行后,如果从键盘上输入ABCDEF,则输出结果为______。includeinclude 以下程序运行后,如果从键盘上输入ABCDEF<回车>,则输出结果为______。 #include<stdio.h> #include<string.h> func(char str[]) { int num=0; while(*(str+num)!='\0') num++; return(num);p } main() { char str[10],*p=str; gets(p);printf("%d\n",func(P)); }A.8B.7C.6D.5

考题 以下程序的输出结果是【 】。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);}

考题 下列程序的输出结果是______。 char*fun(char*str,int n) { int i; char*p=str; for(i=0;i<10;i++,str++) *str='a'+i; return++p; } main() { char a[10]; printf("%s\n",fun(a,10)); }A.ABCDEFGHIJB.abcdefghijC.bcdefghijD.不确定的值

考题 以下函数fun的功能是返回str所指字符串中以形参c中字符开头的后续字符串的首地址,例如,str所指字符串为Hello!,c中的字符为e,则函数返回字符串ello!的首地址。若str所指字符串为空或不包含c中的字符,则函数返回NULL,请填空。char *fun(char *str,char c){ int n=0; char *p=str; if(p!=NULL) while(p[n]!=cp[n]!=’\0’) n++; if(p[n]==’\0’) return NULL; return();}

考题 设有如下函数定义,则输出结果为______。 char*fun (char*str) {char*p=str; while(*p) { if(*p>'d') continue; p++; } return p; } main() { printf("%s\n",fun("welcome!")); }A.welcome!B.come!C.wD.程序陷入死循环中

考题 请读程序: includde include void fun(char * s) {char a[10]; str 请读程序: # includde<stdio.h> # include<string.> void fun(char * s) {char a[10]; strcpy(a,"STRING"); s=a; } main() { char*p; fun(p); print{("%s\n",p); } 上面程序的输出结果(表示空格) ( )A.STRINGB.STRINGC.STRINGD.不确定的值

考题 设有如下函数定义。若在主函数中用语句cout<<f("good")调用上述函数,则输出结果为(48)。 int f(char *s){ char *p=s; while(*p! ='\0')p++; return(p-s); }A.3B.4C.5D.6

考题 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函数有什么结果?( )

考题 char str[ ]= "Hello";char *p=str;int n=10;sizeof(str)=( )sizeof(p)=( )sizeof(n)=( )void func(char str[100]){ }sizeof(str)=( )

考题 有关内存的思考题1. void getmemory(char *p){ p=(char*)mallol(100);}void test(void){char * str =null;getmemory(str);strcpy(str,”hello,world”);printf(str);}请问运行 Test 函数会有什么样的结果

考题 char*getmemory(void){ char p[]=”hello world”;return p;}void test(void){char *str=null;str=Getmemory();printf(str);} 请问运行 Test 函数会有什么样的结果.

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

考题 char *GetMemory(void){ char p[] = "hello world";returnp; }void Test(void){char *str = NULL;str = GetMemory(); printf(str);}请问运行 Test 函数会有什么样的结果?

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

考题 请补充函数fun(),该函数的功能是:把从主函数中输入的字符串str2倒置后接在字符串str1后面。例如:str1=“How do”,str2=“?od uoy”,结果输出:“How do you do?”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define N 40void fun(char *str1,char *str2){int i=0,j=0,k=0,n;char ch;char *p1=str1;char *p2=str2;while(*(p1+i))i++;while(*(p2+j))j++;n=【 】;for(;k=j/2;k++,j--){ch=*(p2+k);*(p2+k)=*(p2+j);*(p2+j)=ch;}【 】;for(;【 】;i++)*(p1+i)=*p2++;*(p1+i)='\0';}main(){char str1[N],str2[N];int m,n,k;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);}

考题 请补充函数fun(),该函数的功能是:把一个字符串中的字符(字母)按从小到大排序,并把这个全部由字母组成的字符串保存在原串中,函数返回这个字符串的长度。例如;输入“cixbr2.3”,如果为bcirx,字符串长度为5。注意:部分源程序给出如下.请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。include <stdio.h>define N 20int fun (char *str){int i=0,j=0,k=-0,m=0;char t;char *p=str;while(*p){if((*p>='A'*p<='Z')||(*p>='a'*p<='z'))【 】p++;}*(str+i)='\0';【 】;while(*(p+j)){k=j;【 】;while (*(p+k)){if(*(p+k)<*(str+m){t=*(str+m);*(str+m)=*(p+k);*(p+k)=t;}k++;}j++;}return i; }main(){char str[81];iht n;clrscr();printf("Input the original string ");gets(str);printf("*** The Original string ***In");puts(str);printf("*** The nwe string ***\n");n=fun(str);puts(str);printf("***The length of new string is:%d***\n",n);}

考题 下面的程序各自独立,请问执行下面的四个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);}}

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

考题 串的操作函数str定义为: int str(char*s){ char*p=s; while(*p!=’\0')p++; return p=s; } 则str("abcde")的返回值是 ( )A.3B.4C.5D.6