Question: 2 . 1 String basics Strings and string literals A string is a sequence of characters, like the text MARY, that can be stored in

2.1 String basics
Strings and string literals
A string is a sequence of characters, like the text MARY, that can be stored in a variable. A string literal is a string value specified in the source code of a program. A programmer creates a string literal by surrounding text with single or double quotes, such as 'MARY' or "MARY".
The string type is a special construct known as a sequence type: A type that specifies a collection of objects ordered from left to right. A string's characters are ordered from the string's first letter to the last. A character's position in a string is called the character's index, which starts at 0. Ex: In "Trish", T is at index 0, r at 1, etc.
participation activity
2.1.1: String indexing.
Type a string below to see how a string is a sequence of characters ordered by position. The numbers on top indicate each character's index.
Type a string
(up to 6 characters)
Trish
012345
T r i s h

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!