Introduction of Strings
Historically, computers were first used for processing numerical data. Today, computers are frequently used for processing non-numeric data, called character data. Now we read how such data are stored and processed by the computer.
Basic Terminology Each programming language contains a character set that is used to communicate with the computer. This set usually includes the following: A finite sequence S of zero or more characters is called a string. The number of characters in a string is called its length. The string with zero characters is called the empty string or the null string. Specific strings will be denoted by enclosing their characters in single quotation marks. The quotation marks will also serve as string delimiters. Hence
Basic Terminology Each programming language contains a character set that is used to communicate with the computer. This set usually includes the following: A finite sequence S of zero or more characters is called a string. The number of characters in a string is called its length. The string with zero characters is called the empty string or the null string. Specific strings will be denoted by enclosing their characters in single quotation marks. The quotation marks will also serve as string delimiters. Hence
‘THE END’ ‘HELLO’ ‘WELCOME’
are strings with lengths 7, 5, 7 respectively. We emphasize that the blank space is a character and hence contributes to the length of the string.
Let S1 and S2 be strings. The string consisting of the characters of S1 followed by the charecters of S2 is called concatenation of S1 and S2; it will be denoted by S1//S2. For example,
‘HI’// ‘ABC’ = ‘HIABC’
Storing Strings:
Generally, strings are stored in three types of structures :- Fixed-length structures
- Variable-length structures with fixed maximums
- Linked List
Post a Comment