This is useful if you want to use an inbuilt data type repeatedly, but want to give it a shorter identifier—similar to aliasing.

#include <iostream.h>
typedef unsigned short int USHORT;
int main(){
 USHORT x = 5;
 USHORT Area = x * x;
 cout << "x = " << x << "\n";
 cout << "Area = " << x*x << "\n";
 return 0;

Suppose you need a hundred or so unsigned short integers….instead of typing the keywords unsigned short int each time, just use USHORT.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License