I\'m declaring character array as char* string. And then I declare other pointer which again refer to original string, then when I\'m going to change any thing on that string, a
you try to modify the string literal. It is an Undefined Behavoiur and everything may happen including the segfault.
from the C standard what is an UB:
—The program attempts to modify a string literal (6.4.5).