Is typedef ever required in C?

前端 未结 15 2853
夕颜
夕颜 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:06

    A typedef is, by definition, an alias. As such, you always could replace the alias with the actual type. It wouldn't be an alias otherwise.

    That doesn't mean avoiding typedef would be a good idea.

提交回复
热议问题