Wednesday, April 2, 2014

[C++]typedef

You can create a new name for an existing type using typedef. Following is the simple syntax to define a new type using typedef:
typedef type newname; 
For example, the following tells the compiler that feet is another name for int:
typedef int feet;
Now, the following declaration is perfectly legal and creates an integer variable called distance:
feet distance;

No comments:

Post a Comment