Write a declaration statement for an array with 10 elements

Write a declaration statement for an array with 10 elements. Assume that the array is going to contain double-precision floating-point temperature data in units of Kelvins. Initialize the array with values of 0 in all elements.

Solution

double temperature[10]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}

Here double signifies the data type of array which is as per requirement double- precision floating point

temperature is the name of the array.

[10] - signifies the size of the array or we can say number of elements array will hold which is 10 as per requirement.

and curly braces will contain intialised values to the array elements which is zero as per requirement.

 Write a declaration statement for an array with 10 elements. Assume that the array is going to contain double-precision floating-point temperature data in unit

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site