有以下程序: #include #include struet A { int a; char b[10]; double c; }; struct A f(struet A t);

admin2021-06-15  21

问题 有以下程序:
    #include
    #include
    struet  A
    {
    int a;
    char b[10];
    double c;
    };
    struct A f(struet A t);
    main( )
    {
    8truet A at={1001,"ZhangDa",1098.0};
    a=f(a);
    printf("%d,%s,%6.1f\n",a.a,a.b,a.c);
    }
    struet A f(struet A t)
    {
    t.a=1002;
    strepy(t.b,"ChangRong");
    t.c=1202.0:
    return t;
    }
    程序运行后的输出结果是(    )。

选项 A、1002,ZhangDa,1202.0
B、1002,ChangRong,1202.0
C、1001,ChangRong,1098.0
D、1001,ZhangDa,1098.0

答案B

解析 本题考查结构体变量的引用以及作为函数参数的用法。题目虽然看似复杂,其实比较容易,f函数的参数是结构体变量,然后对参数重新赋值并返回,所以该题目的答案为B选项。
转载请注明原文地址:https://kaotiyun.com/show/yAtp777K
0

最新回复(0)