Multiple choice technology programming languages

We can modify value of literals as below: char *name="David"; *name='X';

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

String literals in C are stored in read-only memory. Attempting to modify them through a pointer (like *name='X') causes undefined behavior and typically results in a segmentation fault. The correct approach is to use a character array (char name[] = "David") if you need to modify the string contents.