removing the adjacent duplicate characters from a string

for example
if i give ‘HHello’ as input we should eliminate adjacent duplicate characters output would be ‘Helo’

i’m getting a run time error can someone help with the code.thanks in advance

#include<stdio.h>
void change(char *str)
{
    int i=1;
    int j=1;
    int k;
    int d=0;
 while(str[i]!='\0')
 {
    printf("lot");
     if(str[i-1]==str[i])
     {
         k=i+1;
        while(str[k]!='\0'&&str[k-1]==str[k])
         {
             k++;
         }
         i=k;
      }
    str[j]=str[i];
     j++;
     i++;
}
 str[j]='\0';
 printf("%s",str);
}
int main()
{
 change("HHelllo");
 return 0;
}

see this code…i think the problem lies in the way u r passing the string…LINK…hope this helps…:slight_smile: