Sunday, September 26, 2010

Arrays and Null-Terminated Strings

An array is a collection of variables of the same type that are referred to through
a common name. A specific element in an array is accessed by an index. In
C/C++, all arrays consist of contiguous memory locations. The lowest address
corresponds to the first element and the highest address to the last element.
Arrays may have from one to several dimensions. The most common array is the
null-terminated string, which is simply an array of characters terminated by a null.
Arrays and pointers are closely related; a discussion of one usually refers to the
other. This chapter focuses on arrays, while Chapter 5 looks closely at pointers. You
should read both to understand fully these important constructs.

No comments:

Post a Comment