0
I was told that if I work using pointers the program will be faster. If instead of using index to traverse a vector I use the pointer, it looks better?
0
I was told that if I work using pointers the program will be faster. If instead of using index to traverse a vector I use the pointer, it looks better?
4
No, that doesn’t make sense even because the index of a vector is a pointer. Of course there may be some situation that you make wrong and can make a difference, but it is circumstantial. See: Arrays are pointers?. In general it is less readable to use the pointer can the notation of array can be used.
Browser other questions tagged c array pointer
You are not signed in. Login or sign up in order to post.
Look, your question is no different than a four-year-old asking why the sky is blue. It is even possible to give an answer that explains refraction, diffraction and interaction between photons and electrons of nitrogen atoms and oxygen from the air, but this child would not understand any of this. Pointers serve for a plethora of things and may or may not contribute to performance, but to understand a detailed answer to that question, goes far.
– Victor Stafusa
Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site
– Maniero