Arrays

If you declare 3 variables as num1, num2, and num3, 3 separate locations in memory are allocated. These are called scalar variables.

scalar

Instead you could declare num to be an array with a size of 3. The elements of an array are indexed, starting with 0. You would refer to these values as num[0], num[1], and num[3]. The index can be a variable. For example if i=2, then num[i] would be the same as num[2]. This makes it easy to use loops to process the array.

array

Please study the material at each of the links below.

  1. Input 3 numbers
  2. Input and Arrange
  3. Names of Months
  4. Table of Months and days
  5. Table of Months and days formatted
  6. Fast Food menu
Like us on Facebook:


OER: Open Educational Resource
Creative Commons License Author: Janet E. Joy; Publisher: Zebra0.com
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Attribution-NonCommercial 4.0 International License
Last modified: May 23 2017 17:39:21.