Home

A program to explain string manipulations - Part 2

C Programming Language 072

Program

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

void main()
{
    char str1[30], str2[30];

    printf("Enter string1: ");
    gets(str1);

    strcpy(str2, str1);
    printf("String 2 = %s \n", str2);

    strrev(str1);
    printf("Reverse = %s \n", str1);

    strlwr(str2);
    printf("Lowercase = %s \n", str2);

    strupr(str2);
    printf("Uppercase = %s \n", str2);

    printf("\n");
}

Result

Functions such as like strupr, strlwr, strrev, which are only available in ANSI C (Turbo C/C++) and are not available in standard C-GCC compiler.


Last Updated on

Next Post: Rules vs Guidelines →

Comments