An interesting code.

Source: Internet
Author: User

0. Know how the ASCII code character output characters, ASCII decimal, not directly ' \ (ASCII) ', to first convert the ASCII code to 8 binary, and then use ' \ '

1. Recalling while (): The loop terminates when the value inside the parentheses is 0 or ' + ' . (' 0 ' does not terminate in parentheses)

2. Review string Pointers:

Char *s= "ABCDEF";

Assign the address of a to the pointer s, so *s is a, and so on, * (s+1) is b,* (s+2) is C

3. Program

Code:

#include <stdio.h>
int main ()
{
Char *s= "ABCDEF";
while (*s)
printf ("%s\n", s++);
}

As a result, a string defined with a pointer can control where the string begins to print from the address. This position is not necessarily from the front to the back, but also from the back to the front.

If you encounter a problem string pointer, you can find the character in the string by pointer variable, but not the address of the character in the string to find the pointer/

An interesting code.

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.