plz help me to solve the error in this program :

Given programs replaces multiple spaces with only one space...
there is no error , but it shows "Segmentation Fault"...whats the issue ?????????

#include<stdio.h>
int main(void)
{
char *t="ALOK KUMAR   ASHISH KUMAR   ANKUSH";
char *c;
int n1=0;
while (*t)
{
if (*t==' ')
n1++;
if(n1>1)
{
*t=*(t-1);
n1--;
}
*c=*t;
t++;
c++;
}
printf("%s",t);
return 0;
}

The first problem is the program is attempting to change data that is stored in read-only memory. String literals can't be changed. You can correct that by storing the string in read-write memory like this:

char data[]="ALOK KUMAR   ASHISH KUMAR   ANKUSH

After that you will want to set pointer t = data.