Use typedef keyword to define new variable type : typedef « Development « C++ Tutorial






#include <iostream>
 
 typedef unsigned short int USHORT;       
 
 int main()
 {
    USHORT Width = 5;
    USHORT Length;
    Length = 10;
    USHORT Area = Width * Length;
    std::cout << "Width: " << Width << "\n";
    std::cout << "Length: " << Length << std::endl;
    std::cout << "Area: " << Area << std::endl;
    return 0;
 }
Width: 5
Length: 10
Area: 50








5.23.typedef
5.23.1.Use typedef keyword to define new variable type
5.23.2.Use typedef to create new data type and use it as function return type