String Algorithms
Print this page
STRING LENGTH
  • Strings can have an arbitrary but finite length.
  • There are two types of string data types:
    • Fixed length strings
    • Variable length strings
  • Fixed length strings have a maximum length and all the strings uses same amount of space despite of their actual size.
  • Variable length strings uses varying amount of memory depending on their actual size. Throughout of our discussion we assume that strings are of variable length type.
  • Variable length string is an array of characters terminated by a special character.
  • To find the length of a string we scan through the string from left to right until we find the special symbol and each time incrementing a counter to keep track of number of characters scanned so far.
 
Prev