困惑用typedef和指针用C [英] Confusion with typedef and pointers in C

查看:106
本文介绍了困惑用typedef和指针用C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  指针的typedef一个好主意吗?

我很困惑与以下内容:

typedef struct body *headerptr;

现在,当我创建类型headptr东西指向一个结构体,创建一个新的headerptr将如下所示(我不知道如果我正确地做这个):

Now, when I create something with type headptr that points to a struct body, to create a new headerptr would be as follows (I'm not sure if I'm doing this correctly):

headerptr newHeadptr;

我是正确的假设,这将是一个指向结构体的指针?

Am I correct to assume that this would be a pointer that points to a struct body?

推荐答案

是的。 headerptr 是相当于现在结构体*

Yes. headerptr is now equivalent to struct body*.

这篇关于困惑用typedef和指针用C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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