指针

 1 #include <iostream>
 2 using namespace std;
 3 int main() {
 4     char s[] = "Hello World";
 5 //    char *s = "Hello World";     //指针型*s同样适用
 6 
 7     for (int i = 0; i != 11; ++i) {
 8     cout << s[i];         //每次输出一个字符
 9     }
10     cout << endl;
11 
12     for (int i = 0; i != 11; ++i) {
13     cout << *(s + i);     //每次输出一个字符
14     }
15     cout << endl;
16 
17 //    while (*s)
18 //  cout << *s++;    //只有指针型*s适用*s++方法
19 }

原文地址:https://www.cnblogs.com/jfl-xx/p/4937321.html