[Solved] C runtime error (undefined behaviour) for performing ++*(p++) on string literal char *p = “abcd”


char *p="abcd";

"abcd" is a string literal and string literals are unmodifiable in C. Attempting to modify a string literal invokes undefined behavior.

Use a modifiable array initialized by a string literal to fix your issue:

char p[] ="abcd";

7

solved C runtime error (undefined behaviour) for performing ++*(p++) on string literal char *p = “abcd”