Creative pen questions

Source: Internet
Author: User

11.23

1.

Char str1 [] = "ABC ";
Char str2 [] = "ABC ";
Const char str3 [] = "ABC ";
Const char str4 [] = "ABC ";
Const char * str5 = "ABC ";
Const char * str6 = "ABC ";
Cout <boolalpha <(str1 = str2) <Endl; // What is output?
Cout <boolalpha <(str3 = str4) <Endl; // What is output?
Cout <boolalpha <(str5 = str6) <Endl; // What is output?

 

Output values: false, false, and true. Str1 and str2 are character arrays, each of which has its own storage area, and their values are the first addresses of each storage area, not equal; str3 and str4 are the same as above, just according to the const semantics, the data zone to which they direct cannot be modified. Str5 and str6 are not arrays but character pointers and are not distributed to the storage area. The "ABC" after them are stored in the static data area as constants, and they are only pointers pointing to the first address of the area, equal
Boolalpha represents true and false in symbolic form.

 

2. The number of converted strings is an integer.

3. An integer binary tree that calculates the sum of values of all nodes

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.