如下,我的写法一直报错,
#include <stdio.h>
void str(struct person *p);
void str1(struct person a);
struct person{
char *name;
int age;
float high;
};
int main()
{
struct person f={"xiaoming",15,175.0f};
struct person *p=&f;
// str(p);
// str1(f);
return 0;
}
int str(struct person *p)//结构体指针传递,
{
printf("name=%s,age=%d\n",p->name,p->age);
}
void str1(struct person a)//结构体作为参数传递
{
printf("name=%s,age=%d\n",a.name,a.age);
}
感觉子涵的定义有问题,有没有谁知道怎么用这个,指点一下,谢谢! |
|