Storage Format of int in vc6 memory

Source: Internet
Author: User

Data is stored in binary format in the memory.

In vc6, int occupies 4 bytes,

The value is expressed as a complement.

The complement code of a positive integer is the same as the original code of this number.

The complement code of a negative number is the binary form of the absolute value of the number, which is reversed by bit by 1.

Int I = 512;

The binary format is 0x00 00 02 00.

The memory is 0x00 02 00.

# Include <iostream> using namespace STD; int main () {int I, j; I = 512; For (j = 0; j <4; j ++) printf ("% x", * (unsigned char *) (& I) + J); Return 0 ;}

Print the data of each byte from the low position to the high position of the I address.

0 2 0 0
Press any key to continue

The output result is as shown in the preceding figure. Therefore, four int bytes in the PC are stored first, and then in the upper part.

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.