User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 429,998 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,522 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums

MERGED: Deleting duplicates in an array (plz help me out!!!!!!!)

Join Date: Oct 2004
Posts: 47
Reputation: galmca is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
galmca galmca is offline Offline
Light Poster

deleting duplicates in array

  #1  
Oct 28th, 2004
hi guys......
i have a problem in writing a program of "how to delete the duplicate elements in an array"
for example....if i enter an array like:
10 20 30 40 30
then it should print:
10 20 30 40

so could plz help me out????? :cry:
i have attempted little though....but don't know how can i go ahead....

#include<stdio.h>
#include<conio.h>
int main(void)
{
int a[5],i,j;
clrscr();
printf("ENTER ARRAY ELEMENTS:");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
fflush(stdin);
for(i=0;i<5;i++)
{
for(j=i;j<4;j++)
{

//i don't know now where do i go....from here on.....how to find the element which is repeating that is the duplicate and then how to delete that.....
so plz help me out......
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 12:57 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC