Common C + + interview Summary

Source: Internet
Author: User
Specify alignment values:#pragma pack (n),n=1,2,4,8,16 changes the alignment factor of the system
Structs and unions are composed of several different data type members, but at any one point, the union only holds a selected member, and all members of the struct exist.
In a struct, each member occupies its own memory space, which is present at the same time.
The total length of a struct variable equals the sum of all member lengths.
In union, all members cannot occupy their memory space at the same time, and they cannot exist at the same time.
The length of the union variable equals the length of the longest member.
Assigning values to different members of union will be overridden for other members, the original member's value will not exist, and the different member assignments for the struct are not affected.
Http://www.cnblogs.com/LUO77/p/5771237.html

Common C + + interview Summary

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.