Federation and how to bring up memory windows

Source: Internet
Author: User

Consortium Related:

In fact, the Union is basically the same as the struct usage, but the union is a common piece of memory here.

In order to properly demonstrate all of its contents, a memory window needs to be called. This was a bit of a time to find out. To share.

Such direct execution simply does not see the specific execution process.

But how do you see them sharing a piece of memory?

from the current window is no way to view the memory, the program must run up ~ to see. But how can I look at it halfway? ~ So in vs2010 and above, calling the memory window is a big premise of setting breakpoints for the program you're working on:

Such as:

Then run the program.

Enter the current interface.

Press F11 to run one step.

And then found that both in the VS compiler environment or in our small window, we saw the next step of the program, and now hit the three address of the consortium. The next step should be to view it in the Memory window.

In run: Click the Debug drop-down menu:

Then click Memory---memory 1(1), window .

And then you can see the bottom left corner. We want the window:

So the memory window appears.

Because our output window is even displayed as:

So we enter this address in memory:

Then tap Enter. You can see the result of our output:

Start execution of Union myunion u;

You get a space, the first address is 0x0034fabc, and the length is 8 bytes.

Then the u.a = 0x1234

The following memory is displayed:

34 12 00 00

Then we execute u.b = 1l

The memory displays are:

01 12 00 00

Then print the amount of memory that the consortium occupies:

4

They then output the addresses of each of their sub-variables, and find that they share a single address in the union, and modify the values in the same place.

Federation and how to bring up memory windows

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.