69,382
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <stdbool.h>
#define STR 40
#define NUM 12
typedef struct {
int num;
bool flg;
} seats;
void test(seats (*list)[]);
int main(void){
seats seats_list[NUM];
test(&seats_list);
printf("seats_list[0].num = %d", seats_list[0].num);
printf("seats_list[0].flg = %d", seats_list[0].flg);
return 0;
}
void test(seats (*list)[]){
int i = 1;
list[i]->num = 1;
list[i]->flg = false;
}
#include <stdio.h>
//#include <stdbool.h>
#define STR 40
#define NUM 12
typedef struct {
int num;
bool flg;
} seats;
void test(seats (*list)[NUM]);
int main(void){
seats seats_list[NUM];
test(&seats_list);
printf("seats_list[0].num = %d", seats_list[0].num);
printf("seats_list[0].flg = %d", seats_list[0].flg);
return 0;
}
void test(seats (*list)[NUM]){
int i = 0;
list[i]->num = 1;
list[i]->flg = false;
}
//相当于一个二维数组必须指定第二维的大小