-->
Showing posts with label WAP to reverse a string using(strrev()) function.. Show all posts
Showing posts with label WAP to reverse a string using(strrev()) function.. Show all posts

WAP to reverse a string using(strrev()) function.

using turbo c++
-------------------------------------------
//WAP to reverse a string using(strrev()) function.
#include <stdio.h>
#include<string.h>
#include<conio.h>
int main()
{
    char name[100];//two dimensional declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strrev(name);
    printf("reverse=%s\n",name);//prints the name
     getch();
    return 0;
}
-------------------------------------------------
in codeblocks
------------------------------------------------------
//WAP to reverse a string using(strrev()) function.
#include <stdio.h>
#include<string.h>
int main()
{
    char name[100];//two dimensional declaration
    printf("enter string\n");
    //fgets(name, sizeof (name), stdin);
    scanf("%[^\n]s",name); //it also CAN BE USED. IT accepts string with space until it meets new line
    strrev(name);
    printf("reverse=%s\n",name);//prints the name
    return 0;
}