keywords:typedef

C++ Reference

typedef

Syntax:

    typedef existing-type new-type;

The typedef keyword allows you to create a new alias for an existing data type. This is often useful if you find yourself using a unwieldy data type – you can use typedef to create a shorter, easier-to-use name for that data type. For example:

    typedef unsigned int* pui_t;
 
    // data1 and data2 have the same type
    pui_t data1;
    unsigned int* data2;