结构体指针

结构体指针

**作用:**通过指针访问结构体中的成员。

利用操作符->可以通过结构体指针访问结构体属性。

cpp 复制代码
struct student()
{
    string name;
    int age;
    int score;
}
int main()
{
    student s = {"张三",18,100};
    struct *p = &s;
    cout << "姓名:" << p->name << "年龄:" << p->age << "分数:" << p->score << endl;
}
相关推荐
孤飞2 小时前
zero2Agent:面向大厂面试的 Agent 工程教程,从概念到生产的完整学习路线
算法
lclin_20203 小时前
VS2010兼容|C++系统全能监控工具(彩色界面+日志带单位+完整版)
c++·windows·系统监控·vs2010·编程实战
技术专家3 小时前
Stable Diffusion系列的详细讨论 / Detailed Discussion of the Stable Diffusion Series
人工智能·python·算法·推荐算法·1024程序员节
csdn_aspnet4 小时前
C# (QuickSort using Random Pivoting)使用随机枢轴的快速排序
数据结构·算法·c#·排序算法
以神为界4 小时前
Python入门实操:基础语法+爬虫入门+模块使用全指南
开发语言·网络·爬虫·python·安全·web
鹿角片ljp4 小时前
最长回文子串(LeetCode 5)详解
算法·leetcode·职场和发展
逻辑驱动的ken4 小时前
Java高频面试题:03
java·开发语言·面试·求职招聘·春招
噜噜大王_5 小时前
深入理解 C 语言内存操作函数:memcpy、memmove、memset、memcmp
c语言·开发语言
广师大-Wzx5 小时前
一篇文章看懂MySQL数据库(下)
java·开发语言·数据结构·数据库·windows·python·mysql
野生技术架构师5 小时前
Java NIO到底是个什么东西?
java·开发语言·nio