C++ examples for Data Type:typedef
A typedef requires typedef followed by the existing type and its new name.
typedef unsigned short USHORT
#include <iostream> int main() //from w w w .j a v a2s.c om { // create a type definition typedef unsigned short USHORT; // set up width and length USHORT width = 6; USHORT length = 4; USHORT area = width * length; std::cout << "Width: " << width << "\n"; std::cout << "Length: " << length << "\n"; std::cout << "Area: " << area << "\n"; return 0; }