About the C + + string while (*temp++)

Source: Internet
Author: User

First, the previous section of code

Static BOOLREVERSE_STR (Const Char*str) {    Const Char*temp=str;  while(*temp++); Temp-=2;//the pointer returns to the end of the string     while(str<temp) {        if(*str!=*temp) {            return false; } STR++; Temp--; }    return true;}

In fact, it is done is to return to the word string judgment.

Inside of a code:

Const Char *temp=str;      while (*temp++);    Temp-=2;        // the pointer returns to the end of the string

Here's

temp-=2;

is to return the character at the end of the string. Take a look here and write that.

In addition, write code to pay attention to normative

Note the static keyword in front of the function

and the const keyword in front of the function parameter

About the C + + string while (*temp++)

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.