190k views
5 votes
Strings can be of two types. String literals and array of characters. Which one is read-only?

User JGTaylor
by
8.1k points

1 Answer

6 votes

Final answer:

In programming, string literals are read-only while arrays of characters are mutable and can be changed.

Step-by-step explanation:

When working with strings in programming, there are typically two types: string literals and arrays of characters. String literals, which are often defined by enclosing text within quotes, are read-only. This means that once a string literal is set, its contents cannot be altered. On the other hand, an array of characters is mutable, meaning that you can change individual characters within the array.

User Foolish Chap
by
7.6k points