Thursday, June 15, 2006

Duplicate Characters deletion - String Operation

String Operation
Duplicate Characters deletion
/*
Name: Duplicate Characters deletion
Copyright: StarSoft
Author: Vijayakumar M
Date: 28/04/06 11:14
Description: To Remove Duplicate
characters in a string.
*/
#include
#include
#include
main()
{
char string[40]="thats goods super star";
char *p= string;
int i, j;
printf( "%s\n", string );
for( i=0;i {
for( j=i+1; j {
if( string[i]==string[j])
*(p+j)='*';
}
}
printf( "%s\n", string );
for( i=0;i {
if( string[i] != '*' )
printf( "%c", string[i] );
}
   getch();
}

No comments: