5. Typedef
|
|
C provides a facility called typedef for creating new data type names. For example, the declaration |
typedef int Length;
Length len, maxlen;
Length *lengths[];
typedef char *String;
String p; |
|
|
Simplifying a declaration |
struct var {
int data1;
char data2;
};
struct var a;
typedef struct var newtype;
newtype var b; |
|
typedef struct {
int data1;
char data2;
} newtype;
newtype a; |
|
|
|
|