SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
Arrays
Exercise:
Self-test Exercises
Question:2 | ISBN:9780321531346 | Edition: 7

Question

In the array declaration

       double score[5];

state the following:

a. The array name

b. The base type

c. The declared size of the array

d. The range of values that an index for this array can have

e. One of the indexed variables (or elements) of this array

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

Consider the given delclaration of array:

                     double score[5];

a)

The array name is "score".

Explanation: The variable name "score" contains square braces in given array declaration. It represents the array name. 

b)

The base type is "double".

Explanation: The base type means data type of the array. In given array declaration contains "double" data type. It accepts an interger and floting type values for the array.

c)

The declared size of the array is "5".

Explanation: Inside braces value represents the size of the given array. The array name 'score' contains the size is 5 in given array declaration. 

d)

The range of values that an index for this array can have 0 through 4.

Explanation: The declaration of array range "score[5]" defines range 0,1,2,3, and 4. The index of given array is score[0],score[1],score[2],score[3],score[4]. 

e)

One of the indexed variables (or elements) of this array represents any of score[0],score[1],score[2],score[3],score[4].

0 0

Discussions

Post the discussion to improve the above solution.