Link Search Menu Expand Document

Lesson 2: Data Structure - Arrays

Exercise 1: Printing all elements of an array

In this exercise you shall define an array of the type of your choice. Now print every element of the array, where each element will be printed on a single line.

Exercise 2: Finding the Max or Min of an array

Define an integer or an double array. Now write some code which finds the minimum and maximum element of this array and print these values.

Exercise 3: Switching two array values

Define an array of the type of your choice. Now ask the user for two indexes. Now switch the value of the array elements at these positions.

Exercise 4: Resizing an array

Create an array of the type of your choice an fill it with values. Now write some code, which resizes this array by x elements. Fill the gap at the end of the arrays with values and print it to see if your solution works.