String Applications

By: Jesse Miller

A string of text is a series of characters, usually forming words. In C programming each character has a unique ASCII code value, including punctuation and non-printing characters such as newline and tab. These are used by C to treat characters numerically. For instance, characters can be changed arithmetically. The ASCII code values for lower case letters are always 32 higher than those of upper case letters, so the case of a character can be changed by adding or subtracting a value of 32.

C does not have a dedicated string data type, but relies instead upon its char data type to store strings as character arrays. A char array to store a string is declared by specifying the data type, array size, and no of characters to store. This declaration reserves sufficient memory space to store six characters. Filling each of these six array elements with characters does not create a string in this array is that the final element must contain the 0 null character. The inclusion of a 0 null character in the final element of a character array promotes the array to string status where the entire array is regarded as a `string constant`. In a string constant the name of the array acts as an implied pointer to the entire string of characters, ending with the 0 null character. The sizeof() function will return the size of the string when passed a string`s name as its argument. A string may be assigned to a char array or to a char pointer.

In C character values must be enclosed by single quotes. Strings must be enclosed by double quotes. The scanf() function is used as a means of character input from the user. This function works well for single characters or multiple characters forming a single word. The problem is that scanf() stops reading the input when it encounters a single space or when the return key is pressed. A string sentence cannot be input using scanf () as soon as space is input the string ends. A solution to the scanf() problem lies with the two standard functions located in the stdio.h header file.

Quick Note: Taking the Nonsense out of looking for the right spyware remover

If you really want to take the work out of looking for that right Spyware Protection from a go to the Internet and get a or a Free
Download, In order to prevent your vital information from being ripped from your computer get your Remover Today.

The first function is named gets () and is used to read input from the user. It can then assign the input string to a char array specified as its argument. If a return key is pressed, newline character is input.

Top Searches on
Software
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 
 • 

» More on Software
 



Share this article :
Click to see more related articles