我有 6 层嵌套结构。我在最后三个级别有问题。该程序编译得很好,但是当我运行它时,它会因分段错误而崩溃。作业有问题是我的感觉。请指出错误。
typedef struct {
char addr[6];
int32_t rs;
uint16_t ch;
uint8_t ap;
} C;
typedef struct {
C *ap_info;
} B;
typedef struct {
union {
B wi;
} u;
} A;
function1(char addr , int32_t rs, uint16_t ch, uint8_t ap) {
A la;
la.u.wi.ap_info->addr[6] = addr;
la.u.wi.ap_info->rs = rs;
la.u.wi.ap_info->ch = ch;
la.u.wi.ap_info->ap = ap;
}