Tagged: Pointer Arithmetic


Programming In C: Arrays With Pointers

Pointers and arrays are closely related in C.  Using indexes and pointers to access the contents of an array are simply two sides to the same coin.  They offer two perspectives that aim towards the same goal.  With pointer arithmetic (which we covered in the article on pointers), you can access each element in the array one after another or randomly.  With array indexing you can specify a short hand number that is easier to understand and read but does the same thing.


Programming in C: Pointers

Pointers at this point in the article series may seem like more of a pain that a boon, but they are very powerful when it comes to constructing articulate programs. Pointers allow us to pass the memory addresses of specific objects around in our programs, and to modify memory in various places.