Google search

Basic and advanced computer skills like Excel with macros, How to speed up your PC, C, CPP, Java programming, HTML, JavaScript, PHP, Wordpress, all web tools, Android tutorials, MySQL Tutorials, WAMP server installation. etc.

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:-

  • An array must be declared before it is used.
  • An array name has the same rules applicable to it that are defined for variable names.
  • An array name cannot be the same as an existing variable name or constant name.
  • Array size specified in the declaration statement must be a positive integer value or a constant containing a positive integer value.
  • It is invalid to assign an array to another by using the assignment operator. For example, If num and num2 are  arrays, it is invalid to write num2 = num.

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.


No comments:

Post a Comment