Skip to Main Content
C Programming: Visual Quickstart Guide
book

C Programming: Visual Quickstart Guide

by Larry Ullman, Marc Liyanage
October 2004
Beginner content levelBeginner
408 pages
9h 24m
English
Peachpit Press
Content preview from C Programming: Visual Quickstart Guide

Using Multidimensional Arrays

The power of an array can be greatly increased by creating multidimensional arrays: an array whose element values are also arrays. This concept is tough to visualize (it's roughly equivalent to a stack of two-column tables) but not that hard to use.

All of the same rules for arrays apply to multidimensional arrays. Once again you'll use the square brackets to indicate the number of elements. This time you'll do so twice:

float grades[3][20];

The first number indicates the number of subarrays (or tables, in layman's terms) the main array contains. The second number specifies the number of rows each subarray (table) contains.

Populating multidimensional arrays is also tricky. You first refer to the subarray index ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Intermediate C Programming

Intermediate C Programming

Yung-Hsiang Lu
Data Structures Using C

Data Structures Using C

Samir Kumar Bandyopadhyay, Kashi Nath Dey

Publisher Resources

ISBN: 0321287630Purchase book