You will need
- The compiler, a language reference, programming
In order to learn how to solve tasks with arrays, it is important to understand their nature and purpose. An array is an ordered structure of information. It can be represented differently as a group of variables of the same type, arranged in order. Arrays can be one dimensional (the variables lined up in a row), two-dimensional (then we are talking about the matrix with rows and columns) and multidimensional. Most often the tasks we use one-dimensional and two-dimensional arrays.
The decision of any tasks with arrays , you start with their ad. Ads in every programming language is different, however, possible to identify similar aspects. So, in almost all languages, when declaring an array it is necessary to describe its type (numeric, character, or custom), the number of elements and dimensions. To understand how to declare an array you need from the condition tasks. If we are talking about processing n elements of input from a file or from the keyboard, you must use one-dimensional arrays, if the problem is in the processing of the matrix use a two-dimensional.
The main goal of any task with arrays is to process their elements. To do this, when processing one-dimensional arrays using a for loop, in which the numbering (value of the loop variable (i) store the first element, ending its run last (until i < n), with a step equal to one (i = i + 1). In this cycle we need to convert array elements or to extract from them important information. Data conversion is achieved by manipulation of A[i] array element, where A is the original declared array.
For processing two-dimensional arrays, you must use not one, but two of the for loop. The variable names of the cycles to be different, for example i and j. Appeal to the element of the array is achieved by the command A[i][j]-.