Tripti Tiwari
How can typedef be to define a type of structure?
By Tripti Tiwari in C, C++, MFC on Oct 04 2013
  • Tripti Tiwari
    Oct, 2013 4

    typedef declaration helps to make source code of a C program more readable. Its purpose is to redefine the name of an existing variable type. It provides a short and meaningful way to call a data type. typedef is useful when the name of the data type is long. Use of typedef can reduce length and complexity of data types.
    Note: Usually uppercase letters are used to make it clear that we are dealing with our own data type.
    Example:
    struct employee {
    char name[20];
    int age;
    };
    struct employee e;
    The above declaration of the structure would be easy to use when renamed using typedef as:
    struct employee {
    char name[20];
    int age;
    };
    typedef struct employee EMP;
    EMP e1, e2;

    • 1
  • Neeraj Kumar
    Jun, 2015 8

    Read this link http://www.tutorialspoint.com/cprogramming/c_typedef.htm

    • 0
  • uday kishore
    Aug, 2014 13

    Can you please have a look at the link for the same.http://mfc-faq.blogspot.in/2014/07/what-is-typedef.html

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS