以下程序运行后的输出结果是( )。 include main() {char ch[]="abcd",x[4][4];int i; f以下程序运行后的输出结果是( )。 include<string.h> main() {char ch[]="abcd",x[4][4];int i; for(i=0;i<4;i++)strcpy(x[i],ch); for(i=0;i<4;i++)printf("%s",&x[i][i]); printf("\n"); }

题目
以下程序运行后的输出结果是( )。 include main() {char ch[]="abcd",x[4][4];int i; f

以下程序运行后的输出结果是( )。 include<string.h> main() {char ch[]="abcd",x[4][4];int i; for(i=0;i<4;i++)strcpy(x[i],ch); for(i=0;i<4;i++)printf("%s",&x[i][i]); printf("\n"); }


相似考题
更多“以下程序运行后的输出结果是( )。 include<string.h> main() {char ch[]="abcd",x[4][4];int i; f ”相关问题
  • 第1题:

    以下程序段的输出结果是 ______。includevoid main(){ char*p[5]={"ABCD","EF","GHI

    以下程序段的输出结果是 ______。 #include<iostream.h> void main(){ char*p[5]={"ABCD","EF","GHI","JKL","MNOP"}; char **q=p; int i; for(i=0;i<=4;i++) cout<<q[i]; }

    A.ABCDEFGHIJKL

    B.ABCD

    C.ABCDEFGHIJKMNOP

    D.AEGJM


    正确答案:C

  • 第2题:

    有以下程序: int fa(int x) { return x *x;} int fb(int x) { return x *x *x;} int f(int( *f1)( ),int( *f2)( ),int x) { return f2(x)-f1(x);} main( ) { int i; i=f(fa,fb,2);printf("%d\n",i); } 程序运行后的输出结果是

    A.-4

    B.1

    C.4

    D.8


    正确答案:C
    解析:本题考点是函数之间的参数传递。

  • 第3题:

    以下程序运行后的输出结果是() 。   #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。

  • 第4题:

    有以下程序: int fa(int x) { return x*x; } int fb(int x) { return x*x*x; } int f(int (*f1)(),int (* f2)(),int x) { return (*f2)(x)-(*f1)(x); } main() { int i; i=f(fa,fb,2); printf("%d\n",i); } 程序运行后的输出结果是( )

    A.-4

    B.1

    C.4

    D.8


    正确答案:C

  • 第5题:

    有以下程序: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。