#include"stdio.h"
#include"string.h"
struct student{
int num;
char name[20];
float score[3];
};
void print(struct student);//必须放到结构体后面,否则,系统无法知道下面的结构体
void one(struct student *);
main()
{
struct student stu;
struct student *a;
stu.num=4;
strcpy(stu.name,"liang");
//stu.name="sss";//无法直接赋值给数组,需要使用指针
stu.score[0]=1.2;
stu.score[1]=1.2;
stu.score[2]=1.2;
print(stu);
a=stu;
one(&a);
}
void print(struct student stu){
printf("\n%d\n",stu.num);
printf("%s\n",stu.name);
printf("%f\n",stu.score[0]);
}
void one(struct student *p){
printf("\n%d\n",p->num);
printf("%s\n",p->name);
printf("%f\n",p->score[0]);
}
#include"string.h"
struct student{
int num;
char name[20];
float score[3];
};
void print(struct student);//必须放到结构体后面,否则,系统无法知道下面的结构体
void one(struct student *);
main()
{
struct student stu;
struct student *a;
stu.num=4;
strcpy(stu.name,"liang");
//stu.name="sss";//无法直接赋值给数组,需要使用指针
stu.score[0]=1.2;
stu.score[1]=1.2;
stu.score[2]=1.2;
print(stu);
a=stu;
one(&a);
}
void print(struct student stu){
printf("\n%d\n",stu.num);
printf("%s\n",stu.name);
printf("%f\n",stu.score[0]);
}
void one(struct student *p){
printf("\n%d\n",p->num);
printf("%s\n",p->name);
printf("%f\n",p->score[0]);
}