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
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 Ex: In "Trish", T is at index r at etc.
participation activity
: 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 characters
Trish
T r i s h
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
