Skip to content

Instantly share code, notes, and snippets.

@geekoff7
Created July 23, 2018 07:22
Show Gist options
  • Save geekoff7/271147584fea02efbc7c1aabf7e1f639 to your computer and use it in GitHub Desktop.
Save geekoff7/271147584fea02efbc7c1aabf7e1f639 to your computer and use it in GitHub Desktop.
const char
char* is a mutable pointer to a mutable character/string.
const char* is a mutable pointer to an immutable character/string. You cannot change the contents of the location(s) this pointer points to. Also, compilers are required to give error messages when you try to do so. For the same reason, conversion from const char * to char* is deprecated.
char* const is an immutable pointer (it cannot point to any other location) but the contents of location at which it points are mutable.
const char* const is an immutable pointer to an immutable character/string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment