What are the advantages of using typedef in a program?

Answer:
1. Readability. Just like naming your variables properly can show how you intend to use the variable, renaming the type can help show how you intend to use all variables of this type. It eliminates the possible bug of incorrect argument ordering (e.g. if a method signature has multiple boolean flags).
2. Portability. On different systems you might want to have the same variable name (because you're using it the same way) to be of a different type. So you keep the typedef in a header file controlled by conditional compilation (for example) for maximal portability.

3. decreases complexity for declaring complex and repeated declarations like

typedef unsigned long int UINT64;

First answer by ID0414875546. Last edit by Sarnobat. Contributor trust: 0 [recommend contributor recommended]. Question popularity: 4 [recommend question].