Chapter Fourth: User-defined and enumerated data types

Source: Internet
Author: User

This chapter is for readability and the code is self-documenting.

1.typedef Creating user-defined Types

2.enum Creating enumeration types

The enumeration type specifies the range of variables (which can only be evaluated in the specified label), which is commonly used by state machines.

Enumeration types are similar to arrays with specialized system functions.

< enumeration variable name >.first– returns the value of the first member of an enumeration list

< enumeration variable name >.last– returns the value of the last member of the enumeration list

< enumeration variable name >.next (<N>) – Returns the value of the next member of the enumeration list, which can be used as an integer for the second argument, which returns the value of the nth member later

< enumeration variable name >.prev (<N>) – Returns the value of the previous member in the enumeration list

< enumeration variable name >.num– returns the number of elements in the enumeration list

< enumeration variable name >.name– returns the string that corresponds to the value of the enumeration variable and returns an empty string if the value is not in the enumeration variable list

Chapter Fourth: User-defined and enumerated data types

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.