Skip to content

Non const pointer is marked as const pointer #3236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/cpp/raw-pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ A pointer (if it isn't declared as **`const`**) can be incremented or decremente
const char* str = "Hello world";

const int c = 1;
const int* pconst = &c; // declare a non-const pointer to const int
const int* pconst = &c; // declare a non-const pointer to const int -- pconst is const integer pointer but mentioned as non-const pointer
const int c2 = 2;
pconst = &c2; // OK pconst itself isn't const
pconst = &c2; // OK pconst itself isn't const ---- pconst is const integer pointer but mentioned as non-const pointer
const int* const pconst2 = &c;
// pconst2 = &c2; // Error! pconst2 is const.
```
Expand Down