Is typedef ever required in C?

前端 未结 15 2883
夕颜
夕颜 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 14:59

    Individual programmers are not required to create their own typedefs. There's no universal rule saying I can't write things like

    int *(*(*x())[5])();
    

    if I so desire (although my company's coding standards may frown on it).

    They're all over the standard library, however (FILE, size_t, etc.), so you really can't avoid using typedef names.

提交回复
热议问题