Source: [unsplash](https://unsplash.com/photos/white-and-black-star-print-textile-4993XnXQKHY)

Pointer and Const in C++

The following paragraphs are the summary of pointer and const in C++, I always forget about this topic so I decided to create a post about it. Regular Pointers Regular pointers are pointers the we usually use when working with pointers in C++. int main() { int x = 5; int* ptr = &x; // regular pointer to x x = 6; // *ptr would be 6 // we can change the value at the address being held *ptr = 1; // x and *ptr would be 1 int y = 88; ptr = &y; // changing the address that ptr is pointing at return 0; } Pointer to a const value I won’t explain what is it and the rest of the it since it is easier to explain it using code rather than using words. (The definitions are still confusing to me💀) ...

June 15, 2024 · 2 min · Deni Andrian Prayoga