指针ç的typedef结构 [英] C typedef of pointer to structure

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

问题描述

我曾经碰到过下面的code:

I had come across the following code:

typedef struct {
        double x;
        double y;
        double z;
} *vector

这是一个有效的类型定义?的code编译并运行良好。我只是好奇,如果这是常见的做法。

Is this a valid type definition? The code compiles and runs fine. I was just curious if this is common practice.

推荐答案

绝对有效。
通常情况下,你可以通过定义两种类型共同充分利用这种方式:

Absolutely valid. Usually, you can take full advantage of this way by defining two types together:

typedef struct
{
 int a;
 int b;
} S1, *S1PTR;

其中S1是一个结构和S1PTR是指向这个结构。

Where S1 is a struct and S1PTR is the pointer to this struct.

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

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