how this program works

#include <stdio.h>
void sayHello(char *dummyHello)
{
dummyHello[5] = ‘.’;
printf("%s\n", dummyHello);
return ;
}
int main(void)
{
char *dummyHello = “Hello, PreDAC\n”;
sayHello(dummyHello);
return 0;
}

its ans was runtime error…so how it can be work…can any one tell me???

char *dummyHello = "Hello, PreDAC\n"; is likely stored in non-writable memory and you’re trying to change it. Changing that line to something like char dummyHello[15] = "Hello, PreDAC\n"; or perhaps even char dummyHello[] = "Hello, PreDAC\n"; (if your implementation supports it) should solve your issue.