C语言结构体02#include<stdio.h> #include<string>

#include<stdio.h>

#include<string>

struct Student
{
int num;
char name[20];
char sex;
int age;
float score;
char address[30];
};

 

//结构体传带指针的参数

void PrintStruct(struct Student *pStudent)
{
printf("age = %d\n", pStudent->age);
printf("name = %s\n", pStudent->name);

}

 

//定义结构体指针----------
struct Student stu02;
stu02.age = 11;
strcpy_s(stu02.name, "JACK");
PrintStruct(&stu02);

posted @ 2021-09-07 08:44  江南王小帅  阅读(787)  评论(0)    收藏  举报