设有定义  #include <stdio.h>  #include <stdlib.h>  typedef struct{int x,y;}T;  typedef struct{int x,y;} *USER;  USER fun()  {USER p;

admin2022-04-01  21

问题 设有定义
 #include <stdio.h>
 #include <stdlib.h>
 typedef struct{int x,y;}T;
 typedef struct{int x,y;} *USER;
 USER fun()
 {USER p;
    p=(USER)malloc(sizeof(T));
    p->x=1:
    p->y=2;
    return p;
 }
 函数fun返回值的类型是(          )。

选项 A、T类型的结构体
B、指向结构体类型的指针
C、int类型的元素
D、int类型的指针

答案B

解析 由题意可知:使用typedef将类型:struct{int x,y;}*重命名为USER,所以函数fun的返回类型为struct{int x,y;}*,即指向结构体类型的指针,本题答案为B。
转载请注明原文地址:https://kaotiyun.com/show/j2kp777K
0

最新回复(0)