Typedef in C

If you haven’t  Read Enum or Enumeration Click Here to read.

If you haven’t  Read Storage Class in C Click Here to read .

 

Typedef 

Although typedef is thought of as being a storage class, it isn’t really. It allows you to introduce synonyms for types which could have been declared some other way. The new name becomes equivalent to the type that you wanted, as this example shows.

typedef int aaa, bbb, ccc;
typedef int ar[15], arr[9][6];
typedef char c, *cp, carr[100];

/* now declare some objects */
/* all ints */
aaa int1;
bbb int2;
ccc int3;
ar yyy; /* array of 15 ints */
arr xxx; /* 9*6 array of int */
c ch; /* a char */
cp pnt; /* pointer to char */
carr chry; /* array of 100 char */


 

If you have any doubt feel free to comment below 🙂

0 0 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x