string.h Header File in C Programming

‘string.h’ is a header file which includes the declarations, functions, constants of string handling utilities.

These string functions are widely used today by many programmers to deal with string operations.

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 strings.
strcmp -	Compares two strings.
strrev -	Reverses string.
strcpy -	Copies a string from source to destination.

Program :

/*  Program to demonstrate string.h header file working.
Creation Date : 06 Nov 2010 08:10:13 PM
Author : [Technowell, Sangli] */

#include <stdio.h>
#include <conio.h>
#include <string.h>

int main(void)
	char str[50];
	printf("\n\t Enter your name : ");
	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));
	return 0;

Output :

	Enter your name : Technoexam
Lower case of string: technoexam
Upper case of string: TECHNOEXAM
Reverse of string: MAXEONHCET	
Length of String: 10_

Leave A Comment

Your email address will not be published. Required fields are marked *