结构体的形参或实参传递和和一般的程序一样:
#include<stdio.h> #include<string.h> struct student //结构体定义 { char name[10]; int age; double height; }; void chack(struct student *s) //和一般的程序一样也要改成指针 { strcpy(s->name,"LiLin"); s->age=80; s->height=180; } int main() { struct student monitot={"WangLu",10,100}; printf("改变之前:name=%s age=%d height=%.2f\n",monitot.name,monitot.age,monitot.height); chack(&monitot); //取结构体地址 printf("改变之后:name=%s age=%d height=%.2f\n",monitot.name,monitot.age,monitot.height); return 0; }