Wednesday, 29 January 2014

Explain strlwr(),strupr() function with example.

strlwr() function-This function converts any string to a lower case.
syntax
strlwr(upper);

Write a program to convert uppercase string to lowercase.
#include<stdio.h>
#include<conio.h>
main()
{
    char upper[10];
    clrscr();
    printf("Enter the string in uppercase:");
    gets(upper);
    printf("After strlwr(): %s",strlwr(upper));
}
Output
Enter the string in uppercase: ABCD
After strlwr(): abcd


strupr() function-This function converts any string to a upper case.
syntax
strupr(lower);

Write a program to convert lowercase string to uppercase.
#include<stdio.h>
#include<conio.h>
main()
{
    char lower[10];
    clrscr();
    printf("Enter the string in lowercase:");
    gets(lower);
    printf("After strupr(): %s",strupr(lower));
}
Output
Enter the string in uppercase: abcd
After strlwr(): ABCD

No comments:

Post a Comment