Why do we need pointers if we can use ampersand operator? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do we need pointers if we can use ampersand operator?

9th Jun 2019, 6:13 PM
Aditi Bhattacharya
Aditi Bhattacharya - avatar
3 Answers
+ 2
Like everything, there are different ways to do something. which one you choose is just down to preference.
9th Jun 2019, 10:24 PM
Logomonic Learning
Logomonic Learning - avatar
+ 4
they're 2 different things * a reference operator while & is a dereference operator
9th Jun 2019, 8:27 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
See ampersand holds the memory address of the variable and with the help of asterisk * (pointer) we can access the VALUE present in that address...😆
9th Jun 2019, 10:57 PM
Rohit