• 2022-06-08
    以下结构体说明和变量定义中,正确的是( )。
    A: struct abc{ int n;double m );struct abc x, y;
    B: struct ABC{ int n;double m; }struct ABC x, y;
    C: typedef struct abc{ int n;double m; }ABC;ABC x,y;
    D: D) struct abc{ int n;double m; };abc x,y;
  • C

    内容

    • 0

      定义struct s {int x; char y[6];} s1;, 正确的赋值是 A: s1.y=”abc”; B: s1->y=”abc”; C: strcpy(s1.y,”abc”); D: s1.strcpy(y,”abc”);

    • 1

      以下选项中,不能定义s为合法的结构变量的是 。 A: struct abc{double a;char b[10];}s; B: struct{double a;char b[10];}s; C: struct abc{double a;char b[10];};struct abc s; D: struct s{double a;char b[10];};

    • 2

      函数f()定义如下,该函数返回值的数据类型是______。 struct ABC int a;int b;int c;; struct ABC *f(struct ABC abc[2]) return (abc);

    • 3

      写出下面程序的运行结果。struct abc{    int a;                     float b;                     char *c; };          int main(void)           {   struct abc x = {23,98.5,"wang"};   struct abc *px = &x;    printf("%d, %s, %.1f, %s \n", x.a, x.c, (*px).b, px->c );    return 0;}

    • 4

      设有以下说明语句,则下面的叙述正确的是( )。struct abc{int m; float n;}stype; A: struct是结构体类型的关键字 B: abc是用户定义的结构体名 C: m和n都是结构体成员 D: stype是用户定义的结构体变量名 E: struct abc 是结构体类型名