Professional Documents
Culture Documents
Deletion of An Array Element
Deletion of An Array Element
Deletion of An Array Element
1. Read the value of n i.e. the size of an array. 2. Read the elements of array 3. Read the value of pos i.e. the position where you want to insert the element. 4. Read the value of value which is to be inserted. 5. Now after the position where you want to insert the value increase the address of array element by one and shift the element value by one. 6. Now insert the value to the desired place. 7. Now print the resultant element.
{ printf("\n%d",a[i]); } getch(); }
OUTPUT
Enter the number of elements in array 6 Enter Elements of array 3 5 6 9 7 8 Enter the location where you wish to insert an element 3 Enter the value to insert 8 The resultant Array 3 5 8 6 9 7 8
1. Read the value of n i.e. the size of an array. 2. Read the elements of array 3. Read the value of pos i.e. the position of element which you wish to delete. 4. Now after the position where you want to delete the value decrease the address of array element by one and shift the element value by one. 5. Now print the resultant element.
OUTPUT
Enter the number of elements in array 5 Enter Elements of array 3 5 6 9 7 Enter the location which you wish to delete 3 The resultant Array 3 5 9 7 8