结构体03

#include<stdio.h>

#include<string>
struct Student
{
int num;
char name[20];
char sex;
int age;
float score;
char address[30];
};

 


int main() {

 


// 利用指针对结构体操作

struct Student stu;

//初始化指针
struct Student *pStudent = &stu;
pStudent->age = 10;
// pStudent->address = "高新区";
strcpy_s(pStudent->address, "工业园区");

printf("%d\n", pStudent->age);
printf("%s\n", pStudent->address);
return 0;

}

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