"C++" is a string literal stored in read only location and hence cannot be modified. With this -
char* t="C++"; // t is pointing to a string literal stored in read only location
Instead, you should have -
char t[] = "C++" ; // Copying the string literal to array t
to actually do -
t[1] = 'p' ;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…