Created
October 26, 2015 01:55
-
-
Save HereChen/720e052c5c0903703d26 to your computer and use it in GitHub Desktop.
char * - string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(int argc, char const *argv[]) | |
{ | |
const char *p = "shuoming"; // note: const | |
cout << "sizeof(p): " << sizeof(p) << endl; | |
while (*p){ | |
cout << "p++: " << p++ << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment