Why macro can’t be used instead of typedef in C
The C preprocessor blindly expands the macro with whatever they are defined with. Let us examine the following example.
#define CHARPTR char* CHARPTR p1,p2;
The C preprocessor expands the above code to the following.
char *p1,p2;
But we would like p2 to be a character pointer but not a character variable.
So macro are not generally used for variable type definitions as they are not suitable for all sorts of usages. Instead typedef is used as shown below.
typedef char* CHARPTR; CHARPTR p1,p2;
With the above code, the variables p1 and p2 will effectively become character pointers.

