0
Pointers in c++
What is the advantage of using pointers instead of arrays?
3 Respostas
+ 1
What do you mean by "instead of arrays"?
Arrays and pointers are closely related.
+ 1
Jheniffer Gonsalves Sorry if I didn't really get what you meant.
Yes, you can use the array syntax instead of pointers to declare a static array, or to traverse an array. Which one is better? Matter of preference, I would say.
Can an array be used to traverse a container? No. A linked list? No. Managing memory? No. Reference to dynamically allocated memory? No. All of those things, and many more, can be done with pointers.
0
yes. But I can write my code without using pointers. Just arrays. Because c++ will considere it a pointer when necessary. Right? Or I can write it using explicitly pointers. Is there a difference betweeen the 2 ways?