是什么typedef结构节点* NODE说明什么? [英] what does typedef struct node *NODE indicate?

查看:352
本文介绍了是什么typedef结构节点* NODE说明什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 结构节点
{
    INT系数;    INT EXP;    结构节点*链接;
};typedef结构节点*节点;


解决方案

它定义节点作为类型结构节点的代名词* ,所以当你将声明类型的变量节点你会实际上宣告一个指向结构节点

就个人而言,我不认为这样的声明是一个好主意:你隐藏指针(这是几乎总是一个坏主意),而且,你不强调这个事实以任何方式进入新的名称。

struct node
{
    int coef;

    int exp;

    struct node *link;
};

typedef struct node *NODE;

解决方案

It defines NODE as a synonym for the type struct node *, so when you'll be declaring a variable of type NODE you'll be actually declaring a pointer to struct node.

Personally, I don't think that such declaration is a good idea: you're "hiding a pointer" (which is almost always a bad idea), and, moreover, you are not highlighting this fact in any way into the new name.

这篇关于是什么typedef结构节点* NODE说明什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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