Chapter 14: Understanding Arrays and Pointers
C pointers and arrays are closely related; so closely, in fact, that they are often interchangeable! However, this does not mean pointers and arrays are identical. We will explore this relationship and why we might want to use either array notation or pointer notation to access array elements. Most often, we will need to understand this relationship when we pass arrays to functions. So, understanding the interchangeability of arrays and pointers will be essential to making any function that manipulates arrays more flexible and expressive.
Having read two previous chapters, Chapter 11, Working with Arrays, and Chapter 13, Using Pointers, is essential to understanding the concepts presented here. Please do not skip those chapters before reading this one.
The following topics will be covered in this chapter:
- Reviewing the memory layout of arrays
- Understanding the relationship between array names and pointers...