C + + basic structure (originally a kindergarten bag-middle school students ' schoolbags-school bags-students ' bags or suitcases)

Source: Internet
Author: User

Structure I said a few things, but a separate Commission article to tell the reason is because there is a small sad little joy, not like the unexpected will be the two-level pointer of the kind of middle and sad, not like a multi-threaded kind of big sorrow exultation

If you tell someone what the variable is, for example, you will be an example of int or char, before I will int, because int familiar ah, familiar feeling is very simple, the quasi-same

The structure has long been aware of this thing, very early will be created, but has been in practice to avoid encountering, these days packaging multithreading is used to many times, familiar with is not afraid of

What is a struct--------------------------------the packaging of variables (variables can be of the same type can be different types, arrays can only be of the same type)

What is the structure of the--------------------------packaging variables---------------Since packaging, there is more than one variable, one can, no need.

Structure how to use the---------1. Pack a bunch of variables 2. In a bag or a few more bags in the bag, like in the Love apartment Luzicio the gift of apology to Mei Jia

Just an example.

I'm going to pass a char to the function. An int variable--void fun (int X,char p)

I can also use the structure to implement the above requirements struct a{int A; char b;}; --------void Fun (A *p); The pointer I passed into this struct

I can also use two structure to achieve the above requirements of struct a{int A;}; struct b{a *p;char B;}; ------void Fun (b *r); I pass in the B struct pointer, B.p.a point two times to use int variable or B->P->A to refer to two times

(The third general implementation of your multiple objects used in different B, a is the same, as I now encapsulate multi-threaded inside if you sell tickets, multiple threads sell tickets, sell a total number of tickets, but sell the window is not the same)

Now you understand what I mean by the title.

(PanPen120 original)

C + + basic structure (originally a kindergarten bag-middle school students ' schoolbags-school bags-students ' bags or suitcases)

Related Article

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.