+ 1

I don't understand about pointers and &

I understand how to use, but not why they exist? Why I need pointers and that stuff to locate an address?

15th Jul 2019, 7:17 AM
Alex
Alex - avatar
2 Respostas
+ 4
& is a special operator that returns the address of a given variable. The * operator helps retrieve the value stored in the pointer variable. For example, a = 8; int *ptr = &a; Here, the pointer stores the location of the variable a, so that any change in a is reflected in *ptr and vice versa.
15th Jul 2019, 8:27 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Pointer in c++ are used in data structures
15th Jul 2019, 8:15 AM
Saksham Narula
Saksham Narula - avatar