2.9 TYPEDEF FACILITY

We can declare new type names for existing simple or complex types. We know that type unsigned char stores number 0–255. This is exactly what a ‘byte” is supposed to be. Byte is a computer science term that has not defined as a type in C++. In our program we can declare

typedef unsigned char BYTE ;

Thereafter we can continue writing our code as if BYTE is a data type. This is a great facility. Unfortunately, it is not properly utilized by the programmers. Typedef specifier does not reserve storage. It is called storage class specifier for syntactic convenience.

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.