An interesting code
0. Know how to output the AsCii code of a character. The ASCII code is in decimal format and cannot be '\ (ASCII)' directly. First, convert the ASCII code to octal format, and then use '\'
1. Review while (): When the value in the brackets is0 or '\ 0'The cycle ends. (The value '0' in the brackets is not terminated)
2. Review string pointer:
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 ++ );
}
From this we can see that the string defined by the pointer can control the position where the string starts printing 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 with the string pointer, you can use the pointer variable to find the characters in the string, but not the character address in the string to find the pointer/