niusouti.com

阅读下列程序,则在执行后,程序的运行结果为 #include"stdio.h" #include"string.h" main() { char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s\n",a);}A.nice to meet you youB.nice toC.meet you youD.nice to you

题目

阅读下列程序,则在执行后,程序的运行结果为 #include"stdio.h" #include"string.h" main() { char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s\n",a);}

A.nice to meet you you

B.nice to

C.meet you you

D.nice to you


相似考题
更多“阅读下列程序,则在执行后,程序的运行结果为#include"stdio.h"#include"string.h"main(){ char a[ ”相关问题
  • 第1题:

    有以下程序:include include main(){char *p[10]={"abc","aabdfg","dcdbe"

    有以下程序: #include <stdio.h> #include <string.h> main() { char *p[10]={"abc","aabdfg","dcdbe","abbd","cd"}; printf("%d\n",strlen(p[4])); } 执行后的输出结果是( )。

    A.2

    B.3

    C.4

    D.5


    正确答案:A
    解析:p是由10个指向字符型数据的指针元素组成的指针数组,其中前5个数组元素进行了初始化。p[4]="cd",strlen(str)是统计字符串str中字符的个数(不包括终止符'\0'),输出结果为2。

  • 第2题:

    分析下面程序的运行结果()。 #include "stdio.h" #include "string.h" main() { printf("%dn",strlen("IBMn012")); }


    A 解析:在解答本题时应该考虑两个问题:结构体变量的长度及sizeof()求字节数的运算符。结构体变量的长度是其内部成员总长度之和,本题中,structdate中包含year,month,day三个整型变量。一个整型变量所占的字节数为2。

  • 第3题:

    21、以下程序执行后的结果为 。 #include "stdio.h" #include <string.h> void fun(char *s) { char a[10]; strcpy(a,"string"); s=a; } main() { char *p="gao"; fun(p); printf("%s\n",p); }

    A.gao

    B.结果不确定

    C.str

    D.string


    emoclew emoclew

  • 第4题:

    以下程序运行后的输出结果是() 。   #include <stdio.h>   #include <stdlib.h>   #include <string.h>   main()   { char *p; int i;    p=(char *)malloc(sizeof(char)*20);    strcpy(p,"welcome");    for(i=6;i>=0;i--) putchar(*(p+i));    printf("n"); free(p);   }


    D 本程序中通过DATA语句对数组B赋值的结果为矩阵DO循环语句的功能是将数组B的第2列的元素的值依次赋值给数组A。因此,A(1)=4、A(2)=5、A(3)=6,所以格式输出数组A后输出的结果为456。

  • 第5题:

    3、阅读下列程序,则在执行后,程序的运行结果为()  #include <string.h> #include<stdio.h> int main() { char a[30]="nice to meet you!"; strcpy(a+strlen(a)/2,"you"); printf("%s\n",a); }

    A.nice to meet you you

    B.nice to

    C.meet you you

    D.nice to you


    D 在C中,数据只能从实际参数单向传递给形参。