C语言“->”运算符

**“->”:通过结构体指针变量直接获得结构体变量的成员变量。

使用案例

#define _CRT_SECURE_NO_WARNINGS 1
struct Sh
{
    
    
	int num;
};struct Sh s = {
    
     10000 };
void print1(struct Sh* s)
{
    
    
	printf("%d\n", s->num);//指针访问结构体
}
int main()
{
    
    
	print1(&s);
	return 0;
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_52988578/article/details/114490788
今日推荐