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 does struct node * mean?

605


What are the basic data types associated with c?

820


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

585


Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

1624


How do you declare a variable that will hold string values?

672






hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..

1471


Which is the best website to learn c programming?

585


What is the use of a ‘’ character?

589


What do mean by network ?

661


What are runtime error?

634


What does %d do?

729


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

683


What is the difference between call by value and call by reference in c?

621


In a header file whether functions are declared or defined?

632


What does the message "automatic aggregate intialization is an ansi feature" mean?

698