What is a String?

The string is a collection of characters stored under a single name.

It contains the following characters enclosed in double quotes.

  • Alphabets
  • Numbers
  • special characters
  • Spaces and tabs

It is a data type in some programming languages. It contains a literal string value or a declaration as a variable, Variable value can be changed its size.

Generally, string size is counted as the number of characters in it.

String and array characters both contain a group of characters, But they are not the same and equal. Since the string is terminated with a \0 character.

String data structure operations

  • length
  • append
  • reverse a string
  • substring

Difference between String and Array

Array  String  
It stores collection of elements of same typeIt is a collection of characters
Stores the data of any type such Inbuilt and Custom TypesStores Character data
Mutable, Can update the elements in an arrayImmutable