String handling functions :
Some of the standard member functions of string.h header files are,
Function Name | Description |
---|---|
strlen - | Returns the length of a string. |
strlwr - | Returns upper case letter to lower case. |
strupr - | Returns lower case letter to upper case. |
strcat - | Concatenates two string. |
strcmp - | Compares two strings. |
strrev - | Returns length of a string. |
strcpy - | Copies a string from source to destination. |
Program :
/* Program to demonstrate string.h header file working. Creation Date : 30 MAR 2012 08:10:13 PM Author : HARISH */ #include <stdio.h> #include <conio.h> #include <string.h> void main() { char str[50]; clrscr(); printf("\n\t Enter your name : "); gets(str); printf("\nLower case of string: %s",strlwr(str)); printf("\nUpper case of string: %s",strupr(str)); printf("\nReverse of string: %s",strrev(str)); printf("\nLength of String: %d",strlen(str)); getch(); }
Output :
Enter your name : Harish Lower case of string: harish Upper case of string: HARISH Reverse of string: hsiraH Length of String: 6_
No comments:
Post a Comment