161k views
1 vote
Assume that an array of integers named salarySteps that contains exactly five elements has been declared. Write a statement that assigns the value 160000 to the last element of the array salarySteps.

User Aquiseb
by
6.2k points

1 Answer

1 vote

Answer:

salarySteps[4]=160000;

Step-by-step explanation:

  • An array is the collection of elements of the same data type. Its size needs to be mentioned at the time of declaration and it is declared using following syntax: data_type array_name [array_size];
  • for eg: int a[4];
  • To allocate some value to any index we can directly use its index value. The array's index starts from 0. So, if an array has 5 elements, then the index of the last element will be 4.
User Asikorski
by
7.2k points