Site icon

Arrays and Functions

Array is a structure storing elements of similar data types sequentially in memory.

Subscript Array is a structure storing elements of similar data types sequentially in memory (Index) is a variable through which the elements of the array are processed.

Array size is maximum number of elements an array can hold.

Rules for Arrays:-

Types of Arrays:-
  • Single dimension (eg: int rollno[3] = {1,2,3}; )
Single dimensional arrays can have only one dimension and are visually represented as having several rows but a single column of data.
  • Multi dimension ( eg: int matrix_num[4][2]; )
Multidimensional arrays can have more than one dimension although more than two or three are rarely used. They may consist of several rows and columns, as well as multiple dimensions.

 

Sorting:- Sorting is the process of ordering the elements in a proper order. Order can be ascending or descending, depending on the requirement.
  • The process of arranging the elements of an array in a particular order is called sorting.
  • The elements can be sorted either in ascending order or descending order, depending on the requirements.
  • Two of the most commonly used sorting methods are bubble sort and selection sort.
  • Bubble sort is the simplest and relatively slowest of all the other techniques of sorting.
Bubble sort is one of the most commonly used sorting techniques.
Exit mobile version