[C]指针与结构变量
//pointer to structure #include <stdio.h> struct Person { char name[10]; char character[20]; int age; }; void display(struct Person *t); int main() { struct Person man = {"jerry", "fastidious", 45}; display(&man); //取地址,与数组不一样,数组名就是地址,不需要取地址符号& return 0; } void display(struct Person *t) { printf("My name is %s, I'm %d years old. And my friends always complain I'm so %s.\n", t->name, t->age, t->character); //or: // printf("My name is %s, I'm %d years old. And my friends always complain I'm so %s.\n", (*t).name, (*t).age, (*t).character); }