Program test size end

Source: Internet
Author: User

1. Definitions of Big-Endian and Little-Endian are as follows: 1) Little-Endian is the low address of Low-byte emission in the memory, and the high-byte emission in the high address of the memory. 2) Big-Endian refers to the low address of high bytes discharged in the memory, and the low byte is discharged in the high address of the memory. For example, the number 0x12 34 56 78 in the memory is expressed as: 1) Large-end mode: low address ---------------> high address 0x12 | 0x34 | 0x56 | 0x782) Small End mode: low address ----------------> high address 0x78 | 0x56 | 0x34 | 0x12 visible. The large-end mode is similar to the string storage mode. 2. C language test size end [cpp] # include <stdio. h> void main (void) {int a = 0x1234; char B = * (char *) & a; // convert the int type to a single char byte by force conversion, determine the initial storage location. That is, if (B = 0x12) {printf ("big end \ n ");} else printf ("Small End \ n ");}

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.