• 2022-06-09
    以下函数实现的功能是 void fun(char*s) { char*p,*q,temp; p=s; q=s+strlen(s)-1; while(p<q) { temp=*p; *p=*q; *p=temp; p++; q--; } }
    A: 将一个字符串首尾颠倒
    B: 计算字符串的长度
    C: 统计字符串中的空格个数
    D: 将字符串中的小写字母变成大写字母
  • A

    内容

    • 0

      13.若从键盘输入“abc def”并按Enter键,则以下程序的输出结果是____________。 #include #include void main() { char *p,*q; p=(char *) malloc(sizeof(char)*20); q=p; scanf("%s%s",p,q); printf("%s %s",p,q); }

    • 1

      阅读程序填空。以下程序用于实现字符串链接,请在程序空白处将程序补充完整。#include [stdio.h]void MyStrcpy(char *p, char *q);main(){ char a[80], b[80]; printf("Please enter a:"); gets(a); printf("Please enter b:"); gets(b); MyStrcpy(alb); printf("连接后的新字符串:"); puts(a);}void MyStrcpy(char *p, char *q){ while(*p!='\0') { p++; } for( ;*q!='\0';p++,q++) { *p=*q; } ( );}

    • 2

      字符数组s不能作为字符串使用的是【 】。 A: char s[]="happy"; B: char s[]={"happy"}; C: char s[6]={ 'h', 'a', 'p', 'p', 'y'}; D: char s[4]={ 'h', 'a', 'p', 'p', 'y'};

    • 3

      下面程序的运行结果为____。void main(){ char *p,*q;char str[]="Hello,World\n";q=p=str; p++;printf("%s\n",q);printf("%s\n",p); }

    • 4

      字符数组s不能作为字符串使用的是( )。 A: char s[5]={'h','a','p','p','y'}; B: char s[]={"happy"}; C: char s[6]={'h','a','p','p','y','\0'}; D: char s[]="happy";