is pointer notation useful

Aug 21, 2014 at 10:56pm
General question here.

My book shows me the "pointer method" to display an array. Are there any advantages to using this method? I know pointers are important for other things such as dynamic memory allocation, but here the pointer method makes no difference as far as I can see.

Thanks
Aug 21, 2014 at 11:05pm
It makes no difference for arrays. The array subscript syntax is just syntactic sugar for the pointer arithmetic method. If you are working with an array, I'd just use the subscript notation since that more clearly communicates how you are treating the data to other programmers and is far more common.
Aug 21, 2014 at 11:08pm
Thank you! I am going to have to start using the phrase "syntactic sugar," it's kind of awesome.
Topic archived. No new replies allowed.