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;
}