结构体03

时间:2021-09-07 15:19:01   收藏:0   阅读:11

#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

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!