Computer Science, asked by nitin8548, 11 months ago

What are the advantages of using typedef in a program?

Answers

Answered by aleeshah127
1

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;

Explanation:

Similar questions