To Write a C program to remove the repeated characters in
the entered expression or in entered characters(i.e)
removing duplicates.
Answer Posted / anbu
/Made few corrections...
int remove_duplicates(char *str)
{
int char_check=0;
int i,j;
char ch;
char filterstr[256]; // new
if(str == NULL)
return 0;
/* check from 1st character in the string */
while(str[char_check]) {
ch = str[char_check];
i = j = char_check+1;
filterstr[0] = str[0]; // added
/* logic to remove the repeated character */
while(str[i]) {
if(str[i] != ch) {
filterstr[j] = str[i]; //modifid
j++;
}
i++;
}
filterstr[j]='\0'; //modified
str = filterstr; //added
char_check++;
}
printf("String after removing duplicates : %
s\n",filterstr);
return 1;
}
Is This Answer Correct ? | 13 Yes | 9 No |
Post New Answer View All Answers
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
Write a routine to implement the polymarker function
Design an implement of the inputs functions for event mode
could you please send the program code for multiplying sparse matrix in c????
Write a program to model an exploding firecracker in the xy plane using a particle system
How can I Create a C program in splitting set of characters to specific subsets. Example: INPUT SET OF CHARACTERS: Therefore, my dear brothers and sisters, stand firm. Let nothing move you. Always give yourselves fully to the work of the Lord, because you know that your labor in the Lord is not in vain. SPLIT INTO HOW MANY CHARACTERS PER SUBSETS: 10 OUTPUT: Therefore, my dear b rothers an d sisters, stand fir m. Let not hing move you. Alway s give you rselves fu lly to the work of t he Lord, b ecause you know that your labo r in the L ord is not in vain.
How can you relate the function with the structure? Explain with an appropriate example.
#include
write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??
Develop a routine to reflect an object about an arbitrarily selected plane
write a simple calculator c program to perform addition, subtraction, mul and div.
What is full form of PEPSI
can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
Cluster head selection in Wireless Sensor Network using C programming language.