Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
In C,
int* a, b;
Will make a an integer pointer and b an integer.
a
What about this? Is b an integer or an integer pointer?
b
typedef int* foo; foo a, b;
在 C 中,typedef不是预处理器指令:与 不同#define,它不是文本替换。它为现有类型提供了一个替代名称,因此两者a和b都将属于同一类型 - 即foo,它是 的别名int*。此外,你可以这样写:
typedef
#define
foo
int*
foo a, *b;
做a一个int*和b一个int**。
int**