这里写自定义目录标题
c语言结构体指针作为方法入参简单示例
c语言结构体指针作为方法入参简单示例c语言结构体指针作为方法入参简单示例
#include <stdio.h>
#include <string.h>
struct student {
int sno;
char name[10];
float score[3];
};
void fun(struct student *b) {
b->score[0] = 101;
strcpy(b->name, "LiSi");
}
int main() {
struct student t = {102,"ZhangSan",80,90,100};
int i;
fun(&t);
printf("No:%d Name:%s\nScores:",t.sno,t.name);
for(i=0;i<3;i++)
printf("%.2f", t.score[i]);
printf("\n");
return 0;
}
转载自 https://blog.youkuaiyun.com/qq_34378595/article/details/121596804
/