0% found this document useful (0 votes)
48 views2 pages

String Functions in C

The document contains code examples demonstrating how to use three string manipulation functions in C - strlwr to convert a string to lowercase, strupr to convert to uppercase, and strrev to reverse a string. It shows how to prompt the user for input, pass the input string to the functions, and print out the resulting modified strings.

Uploaded by

rajat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

String Functions in C

The document contains code examples demonstrating how to use three string manipulation functions in C - strlwr to convert a string to lowercase, strupr to convert to uppercase, and strrev to reverse a string. It shows how to prompt the user for input, pass the input string to the functions, and print out the resulting modified strings.

Uploaded by

rajat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Function strlwr in C

#include <stdio.h>
#include <string.h>
 int main()
{
char string[1000];
  printf("Input a string to convert to lower
case\n");
gets(string);
  printf("The string in lower case: %s\n",
strlwr(string));
  return 0;
}

Function strupr in C

#include <stdio.h>
#include <string.h>
 int main()
{
char string[1000];
  printf("Input a string to convert to upper
case\n");
gets(string);
 
printf("The string in upper case: %s\n",
strupr(string));
  return 0;
}

Program to reverse a string


#include<stdio.h>
#include<string.h>
 
int main()
{
   char name[30] = "Hello";
 
   printf("String before strrev( ) : %s\n",name);
 
   printf("String after strrev( )  : %s\n", strrev(name));
 
   return 0;
}
 
/*
OUTPUT:
String before strrev( ) : Hello
String after strrev( )  : olleH
*/

You might also like