Is typedef ever required in C?

前端 未结 15 2851
夕颜
夕颜 2021-02-13 14:19

Typedef is very useful for portable names, tag names (typedef struct foo Foo;) and keeping complicated (function) declarations readable (typedef int (*cmpfunc

15条回答
  •  被撕碎了的回忆
    2021-02-13 15:03

    No.

    A typedef does not create a truely new type as say a class in C++, it merely creates a type alias - a single identifier for something else that already exists. In a typedef, you define no new behaviour, semantics, conversions or opeators.

提交回复
热议问题