Skip to content

Instantly share code, notes, and snippets.

@HereChen
Created October 26, 2015 01:55
Show Gist options
  • Save HereChen/720e052c5c0903703d26 to your computer and use it in GitHub Desktop.
Save HereChen/720e052c5c0903703d26 to your computer and use it in GitHub Desktop.
char * - string
#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