箭头操作符( - >)用法在C [英] Arrow operator (->) usage in C

查看:264
本文介绍了箭头操作符( - >)用法在C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在读称为一个良好的入门书学习C自学℃的21天(我已经学会了Java和C#,所以我以更快的速度移动)。我正在读的指针章和 - >(箭头)运算符上来没有任何解释。我认为这是用于调用部件和功能(像。(点)运算的等效的,但对于指针而不是成员)。但我不能完全肯定。我能请得到一个解释和code样?

I am currently learning C by reading a good beginner's book called "Teach Yourself C in 21 Days" (I have already learned Java and C# so I am moving at a much faster pace). I was reading the chapter on pointers and the -> (arrow) operator came up without explanation. I think that it is used to call members and functions (like the equivalent of the . (dot) operator, but for pointers instead of members). But I am not entirely sure. Could I please get an explanation and a code sample?

推荐答案

foo->酒吧等同于(*富)的.bar ,也就是说,它被调用成员从结构的点。

foo->bar is equivalent to (*foo).bar, i.e. it gets the member called bar from the struct that foo points to.

这篇关于箭头操作符( - >)用法在C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆