typedef: We can define our own type and it in the program.
syntax: typedef existing_type new_type_name ;
For example:
typedef int number;
typedef char* pchar;
typedef double[10] dblenum;
Now we can use them as follows
number a;
pchar ptch2;
dblenum money;
When to use it:
- Can be used as alias of frequent used types
- also useful when change type later version
- Shorter name of long and confusing name
No comments:
Post a Comment