Friday, August 19, 2011

Strings

A string is a collection of characters. Just like group of integers can be stored in an integer array, similarly, a group of characters can also be stored in a character array. This array of characters is known as a string. Strings are used for storing and manipulating text such as words and sentences. A string can be stored represented as a one-dimensional char type array where each character of the string is stored as an element of the array.

Defining string:
                      The strings are actually an array of characters so they are defined as:
                             char array-name [size];
Where array-name is the name of string and size represents the maximum number of characters that can be stored and it must be positive integer value. For example:
                               char name[30];

 Array of string:     
 An array of strings can be represented by a two dimensional array where the first size specification tells the number of strings and the second size specification tells the number of characters in each string.
   For example:     char city [4][10];

Previous Next Home
0 Comments
Comments

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More