There is a difference if you want to create a pointer type alias.
typedef int *t1;
t1 a, b; /* a is 'int*' and b is 'int*' */
t2 c, d; /* c is 'int*' and d is 'int' */
In addition, it typedefobeys the scope rules, i.e. you can declare a type as a local block.
On the other hand, you can use #defineit when you want to control the type in the preprocessor directive.
source
share