Data structure and algorithm analysis--Introduction to abstract data types (2)

Source: Internet
Author: User

1. Give a new name to an already existing type, thus creating a new type: typedef oldtype Newtpye;

2, Emum Color{red,orange,yellow,green,blue}; where Color is called an enumeration type, {} is called an enumeration constant

By default, the associative integers of enumerated constants start with 0, this example is 0~4, or can be set to

Emum color{red = 1,orange,yellow,green,blue}; The associated numbers of the new examples are the ";

Emum color{red = 2,orange = 4,yellow = 6,green = 8,blue = 10}; (PS: The output of an enumeration constant is the output of its associated number)

3, pointer variable is a variable, its value is a memory address.

4, the use of new:

int *intptr = new int;

After being executed, new int submits a request to the operating system requiring a piece of memory that is sufficient to hold an integer value (that is, a memory that requires sizeof (int) bytes), and if the operating system satisfies this requirement, the IntPtr will be given the address of the memory location.

5, the pointer is the address of the memory location, the location can only hold the value of that type.

Data structure and algorithm analysis--Introduction to abstract data types (2)

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.