Q49 What is use of typedef ?

typedef is a keyword which is used to give a data type a new name, mainly it is used to give a new and short name of user defined complicate data types. See below how it works.

typedef int own;

int age;            -1

own age;         -2

Above both 1 and 2 declarations are similar.

typedef struct company_employee_detail abc;

struct company_employee_detail  x;

abc  x;

Above both declaration is same.

Leave a Reply

Your email address will not be published. Required fields are marked *

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