Deletion in an array.
For example:
After deletion: A[] = {10,20,30,40,50,60};
Delete an element at index = 3.
After deletion: A[] = {10,20,30,50,60};
Programs:
#include<iostream>
using namespace std;
int main()
{
int A[10] = {10,20,30,40,50,60},delPos = 3;
for(int i=delPos+1;i<6;i++)
{
A[i-1] = A[i];
}
for(int i=0;i<5;i++)
{
cout<<A[i]<<endl;
}
return 0;
}
0 Comment to "Deletion in an array for beginner for free."
Post a Comment
If you have any doubts then let me know.