C, C ++ is easy to ignore

Source: Internet
Author: User

1. String Array. The string pointer can be output directly.

S2 [] = <s2 <* p = <p [] <endl;

2. the pointer Variable p is allocated with four storage units.

Processing strings with pointer variables is more convenient than processing strings with arrays.
The pointer variable is used to store the variable address, which is usually 4 bytes. Therefore, the length of the pointer variable is 4 bytes.

C = (); I = (); l = (); d = (); p = (*); q = (*); View Code

3. When the static keyword defines a static variable, it is equivalent to only executing the first time. The following program result is 6

<Stdlib. h> c = + = (I =; I <=; I ++ = View Code

4. Execute the printf () function from right to left.

* A [] = {, = &, * p, * p ++); View Code

5. How do I design the number of cycles when they are not sure?

For (; * p2 ++ = * p1 ++;); // use a pointer to copy a string
[Example 7.10] use a pointer to copy strings. Output after execution:
S1 = I am a student
S2 = I am a student

<. H> main (* p1 = s1 [], s2 [* p2 = s2; (; * p2 ++ = * p1 ++ ;); cout <s1 <View Code <. h> main (* p1 =; s1 [], s2 [* p2 = s2; I = (; * p1 ++; I ++) cout <I <endl; cout <s1 <View Code

While (* p1! = '\ N '){...}

6. strlen () Evaluate the string length

<. H> * p = a =, a);} View Code

-------------------

To be continued...

 

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.