Use of typedef typedef struct

Source: Internet
Author: User

A typedef is typically used to declare struct-

1. Define some memory-friendly structures or make existing types appear more orderly, such as stdint.h that are added to the C + + standard header file later because they are used frequently

1typedef signedCharint8_t;2typedef Shortint16_t;3typedefintint32_t;4typedefLong Longint64_t;5typedef unsignedCharuint8_t;6typedef unsigned Shortuint16_t;7typedef unsignedintuint32_t;8typedef unsignedLong Longuint64_t;

Uint_8,uint_16,uint_32 this with unsigned numbers in the embedded or other underlying data processing has a sense of neat clean feeling. At the same time if there are certain although it is simple to define, but for the convenience of memory, for example we need to declare a 32-bit file number:

1 typedef Uint32 TFILEINDEX;

This way we declare the variables used to record the sequence number, Tfileindex Findex, can be implemented, but also to remind us of the role of this variable of life. Has a unique effect when dealing with the definition of multiple variables of the same structure.

2, good sleepy, follow-up re-fill

Use of typedef typedef struct

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.