C語言結構體02#include #include


#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);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM