typedef – what are they for

The typedef is to shorten the naming of some types e.g. is you want to have short unsigned called SHORTUN for quicker typing you can use the type definition syntax of

typedef <old type> <new type>

so regarding the example of short unsigned to SHORTUN

typedef short unsigned SHORTUN

a probably better example would be if you wanted to have a apple as a type (which would be a integer value) then you could

typedef in APPLE

now you could use the code

APPLE apple = 1;

Leave a Reply

Your email address will not be published. Required fields are marked *