U-3 String Handling Functions& U-4 Structures in C
U-3 String Handling Functions& U-4 Structures in C
U-3 String Handling Functions& U-4 Structures in C
Presented by
R.Leela Jyothi
strlwr():
It is used to convert all upper case letter
in string to lower case .
Syntax:
strlwr( string);
Program:
#include<stdio.h>
#include<string.h>
int main()
{
char str[20];
printf("Enter string:\n");
gets(str);
strlwr(str);
printf("String in lowercase is:");
puts(str);
return 0;
}
Output:
Enter string:
WELCOME TO C LAB
String in lowercase is: welcome to c lab
strupr():
It is used to convert all lower case letter
in string to upper case.
Syntax
strupr( string);
Program:
#include<stdio.h>
#include<string.h>
int main()
{
char str[20];
printf("Enter string:\n");
gets(str);
strupr(str);
printf("String in uppercase is:");
puts(str);
return 0;
}
Output:
Enter string:
welcome to c lab
String in uppercase is:WELCOME TO C
LAB
strcmp():
This function is used to compare the string
arguments.
It compares both the strings character by
character. It starts comparing the very first
character of strings until the characters of
both strings are equal or NULL character
is found.
If the first character of both strings are
equal, it checks second character and so
on. This process will be continued until
NULL character is found or both
characters are unequal.
Syntax