Wednesday 13 February 2013

String Operations in C Programming Language



String is a sequence of characters in c programming. The important string operations are,

1) Substring
2) Indexing
3) Concatenation
4) Length

Substring in C Programming Language

A group of consecutive characters in a string is called substring. The following three attributes are required to identify the substring in a string.

1) name of the string
2) starting position of the substring
3) length of the substring.

The general form is
substring (str, start, length)

Indexing in C Programming

Indexing is an operating to find the starting index position of first matched substring in a given string. It is also called pattern matching. The substring is called pattern. If the pattern is not available in the given string, then the index values is zero. The general form,

index (str, p)

Concatenation in C Programming language

Concatenation in an operation to join two string values. This gives a single string connecting first string characters followed by second string characters. The general form is

S1 // S2

Length in C Programming Language

Length is an operation to find the number of characters in a string. Ther general form is,

lenght(str)
where str - string of characters

0 comments:

Post a Comment

Powered by Blogger.