Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C program to remove consecutive repeated characters from string

In this tutorial, We have shared how to remove Consecutive Repeated Characters from string using c programming language. This program will read a string and remove repeated consecutive characters from the string and print new updated string.

/**
 * Remove consecutive repeated characters from string using c.
*/
#include 
 
int main()
{
 
    char str[100];
    int i,j,len,len1;
 
    /*read string*/
    printf("Enter any string: ");
    gets(str);
     
    /*calculating length*/
    for(len=0; str[len]!='\0'; len++);
 
    /*assign 0 to len1 - length of removed characters*/
    len1=0;
 
    /*Removing consecutive repeated characters from string*/
    for(i=0; i

Program Output

First Run:
Enter any string: AABBCCDD
String after removing characaters: ABCD

The post C program to Remove Consecutive Repeated characters from string appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

C program to remove consecutive repeated characters from string

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×