🎴 Flashcard Mode

programming languages Online Quiz - 68

Card1 / 20
Mastered0
Review0
QuestionClick to flip

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

AnswerClick to flip back
A
False
💡 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.

Change Mode