by Dinesh Thakur Category: Array Pointer and Union

We Know that C++ Language Provides us the various types of data types like Int,Float Char etc These are also called the Predefined Data types those are used for Storing the values in the Variables



 
by Dinesh Thakur Category: Array Pointer and Union

A single-dimensional array is the simplest form of an array that requires only one subscript to access an array element. Like an ordinary variable, an array must have been declared before it is used in the program. The syntax for declaring a single-dimensional array is

 
by Dinesh Thakur Category: Array Pointer and Union

The function malloc () of header file <stdlib.h> allocates memory of size (in bytes) expressed as its argument. The return value of malloc () is a void pointer to the first byte of the allocated block of memory. However, if the process of allocation of memory fails due to lack of sufficient memory, or due to some other reason, it returns NULL pointer. The argument of malloc () is the unsigned integer or an expression which evaluates to an unsigned integer. Any program using this function should also have statements which check the return value of the function so that if the memory is not available one can gracefully exit from the program.

 
by Dinesh Thakur Category: Array Pointer and Union

Insertion Sort is a sorting technique based on the idea of inserting a new element in a set of given elements so that the resulting elements are also in sorted order. Suppose a set of 4 elements A[0], A[l], A[2], A[3] are to be sorted in ascending order. Initially sort A[0]and A[l] in ascending order. If A[l] is less than A[0], interchange their positions. Otherwise the positions of the elements remain the same. Next insert A[2] in the appropriate position so that the resulting array A[0], A[l] and A[2] remain sorted. The process is repeated in this manner.

 
by Dinesh Thakur Category: Array Pointer and Union

The linear search procedure gives the method of finding whether an element is present in a set of elements (array) or not. The given element is compared with each element in the set one by one. The process is repeated until a perfect match is found. The array comprises of unsorted elements.

 
by Dinesh Thakur Category: Array Pointer and Union

Union is also like a Structure means Unions is also used for Storing data of different data types But the Difference b/w Structure and Union is that Structure Consume the Memory of addition of all elements of Different Data Types but a Union Consume the Memory that is Highest among all variables.



 
by Dinesh Thakur Category: Array Pointer and Union

Like other user defined data types, a structure can also include another structure, as its member, in its definition. A structure defined within another structure is known as a nested structure.



 
by Dinesh Thakur Category: Array Pointer and Union

An array of structures refers to an array in which each element is of structure type. To declare an array of structures, firstly, a structure is defined and then an array of that structure is declared. The syntax for declaring an array of structures is

 
by Dinesh Thakur Category: Array Pointer and Union

Multi-dimensional arrays can be described as 'arrays of arrays', that is, each element of the array is itself an array. A multi-dimensional array of dimension n is a collection of items that are accessed with the help of n subscript values.

 
by Dinesh Thakur Category: Array Pointer and Union

This method assumes that the set of elements in a list is first arranged in ascending or descending order. The list is initially divided into two parts and the mid point is found. If the number to be searched is less than the value of the element at the mid point, it implies that the given number lies in the first part of the list, otherwise the given number lies in the second part of the list. This is illustrated as follows:

 
by Dinesh Thakur Category: Array Pointer and Union

In Bubble sort, two consecutive elements in a given list are compared and their positions in the given list (array) are interchanged in ascending or descending order as desired. Consider the following series of numbers, which are to be arranged in ascending or descending order. The series of numbers to be arranged are presented in the form of an array. The input array has the following form:

 

Page 10 of 18



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.