首页 > 其他 > 详细

结构体03

时间:2021-09-07 15:19:01      阅读:11      评论:0      收藏:0      [点我收藏+]

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

}

结构体03

原文:https://www.cnblogs.com/wang-xiao-shuai/p/15236671.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!