#include <stdio.h>
void func1(char *a);
int main()
{
        char *mStat="welcome home";
        printf("Text before: (%s)\n",mStat);
        func1(mStat);
        printf("Text after: (%s)\n",mStat);
        return 0;
}
void func1(char *a)
{
        printf("Input: (%s)\n",a);
        a[1]='a';
}
This program crashes with a segfault all the time in the line where I am modifying the character in the string. What is wrong with it ? What is the correct way of doing it ?
 
     
    