#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;
}
原文:https://www.cnblogs.com/wang-xiao-shuai/p/15236671.html