【发布时间】:2018-10-24 13:14:03
【问题描述】:
我有一个关于 typedef struct 的问题,我相信我知道答案,但希望得到澄清。
假设我有:
typedef struct Scanner{
//information
}myScanner;
这是否与以下具有相同的含义:
typedef struct Scanner *myScanner;
struct Scanner {
//information
};
【问题讨论】:
-
那不一样。第二个是指针。不鼓励 typedefing 指针!
-
注意Is it a good idea to typedef pointers — TL;DR“否”,可能函数指针除外。