Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Arrays > Two-Dimensional Arrays

Two-Dimensional Arrays

Two-dimensional arrays are even more interesting structures than their single-dimension counterparts. The easiest way to understand or think about two-dimensional arrays is to visualize a table with rows and columns (e.g. a checkerboard, chessboard, or spreadsheet). C, however, implements two-dimensional arrays as single-dimension arrays with pointers to other single-dimension arrays. For ease of understanding, though, envision two-dimensional arrays as a grid or table as mentioned previously.

Two-dimensional arrays are created similar to one-dimensional arrays, but with one exception: two-dimensional arrays must be declared with two separate element numbers (number of columns and number of rows) as shown next.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint