c++ point operation
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(int argc,char *argv[]){
//string hello = "hello";
char *p = "hello";
cout << p << endl;
cout << "print string as old:" << endl;
for(int i = 0; i < strlen(p); i++){
cout << *(p+i);
}
cout << endl;
cout << "print each point to the char in string :" << endl;
for (int i = 0; i < strlen(p); i++){
cout << p+i << endl;
}
cout << endl;
return 0;
}
浙公网安备 33010602011771号