How C + + built-in types are stored in computer memory

Source: Internet
Author: User

Summary: Built-in type of machine implementation, Word/byte/bit, memory

First, the concept

The computer stores data in a bit sequence, with each bit not 0 or 1, such as: 00011011011100010110010000111011 ...

Second, the computer to block to handle memory

    • The computer handles memory as a block with a power of 2 whole number of bits
    • Bytes: The smallest addressable memory block, for most machines, a byte is made up of 8 bits (that is, the addressable memory block has 8 bits)
    • Word: The basic unit of storage, for most machines, a word consisting of 4 bytes

Third, the search (memory) address

The Computer Associates each byte in memory with a number , which is what we call an "address."

For example, on a machine with a byte of 8 bits and a word of 32 bits, we can see the memory area of a word as follows:

byte Address in memory bytes (min memory block)
736424 0 0 1 1 1 0 1 1
736425 0 0 0 1 1 0 1 1
736426 0 1 1 1 0 0 0 1
736427 0 1 1 0 0 1 0 0< /td>

Iv. the importance of data types for addresses

We can use an address to represent a different size string starting at this address, for example, we might say the word in address 736424 or the byte of address 73647.

In order to give a clear meaning to an address in memory, you must first know the type of data stored at that address. The type determines the number of bits that the data occupies and how the content of those bits is interpreted.

How C + + built-in types are stored in computer memory

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.