Write a program for deleting duplicate elements in an array

Answer Posted / bhanuprakash a

/* here is the actual logic */
for(i=1; i<n; i++)
{
for(j=i+1;j<=n;j++)
{
if(a[i] = a[j])
{
for(k=j;k<n;k++)
{
a[k]=a[k+1]; //deletion
n=n-1;
}
}
}
}

Is This Answer Correct ?    7 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a constant and types of constants in c?

594


What is hashing in c language?

603


Explain how can a program be made to print the line number where an error occurs?

682


Does c have circular shift operators?

715


What are the ways to a null pointer can use in c programming language?

581






What does p mean in physics?

577


How to compare array with pointer in c?

610


What are the advantages and disadvantages of pointers?

567


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

700


When is a void pointer used?

670


What is the use of bitwise operator?

676


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

2565


Explain what is the difference between null and nul?

644


Explain enumerated types.

592


What is a pointer on a pointer in c programming language?

609