Python 如何给 c 函数传递结构体参数

2025-02-26 07:17:01
推荐回答(1个)
回答1:

 //test1.c# include # include struct Student
{    char name[30];    float fScore[3];
};void Display(struct Student su){    printf("-----Information------\n");    printf("Name:%s",su.name);    printf("Chinese:%.2f\n",su.fScore[0]);    printf("Math:%.2f\n",su.fScore[1]);    printf("English:%.2f",su.fScore[2]);    printf("平均分数为:%.2f\n",(su.fScore[0]+su.fScore[1],su.fScore[2])/3);
}