test c++
#include <iostream> using namespace std; int main() { char myChar[6] = { 'H', 'e', 'l', 'l', 'o', '\0' }; //char* pointer = myChar; //WORKS!!! char* pointer = &myChar[0]; //ALSO WORKS!!! cout << myChar << endl; //Hello cout << &myChar << endl; //00000030DDEFF744 Array start cout << myChar[0] << endl; //H cout << myChar[1] << endl; //e cout << &myChar[0] << endl; //Hello cout << pointer << endl; //Hell0 cout << *pointer << endl; //H cout << *(pointer + 1) << endl; //e cout << *(pointer + 2) << endl; //l cout << (const int*)pointer << endl; //00000030DDEFF744 = &myChar cout << &pointer << endl; //00000030DDEFF768 ptr itself return 0; }
##################################
标签:myChar,c++,char,test,WORKS,pointer From: https://www.cnblogs.com/herd/p/18110629