结构指针与实际结构 [英] Struct pointer versus actual struct

查看:53
本文介绍了结构指针与实际结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 struct somestruct* mystruct = ... 是指向 somestruct 类型结构的指针?* 不是取消引用 mystruct 吗?

Why is struct somestruct* mystruct = ... a pointer to a struct of type somestruct? Doesn't the * dereference mystruct?

推荐答案

在变量声明中,* 是类型说明符的一部分.

No. In a variable declaration, the * is part of the type specifier.

我知道一开始有点令人困惑,但事实就是如此.如果您发现很难习惯尝试复制一些涉及指针符号的表达式并练习将它们翻译成英语,例如somestruct 指针 my struct 等于..."和mystruct 指向的值是...".

I know that's a little confusing at first, but that's really just how it is. If you find it hard to get used to try copying down a number of expressions involving pointer notation and practice translating them into English, like "somestruct pointer my struct equals..." and "the value pointed to by mystruct is...".

这篇关于结构指针与实际结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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