C Program To Reverse A Given String


♣ Try it Out ::
#include<stdio.h>
#include<conio.h>
#define MAX 101

StringReverse(char *str)
{
    int len = strlen(str), i;
    for(i=len-1; i>=0; i--)
        printf("%c", str[i]);
    printf("%c", str[i]='\0');
    return;
}

main()
{
    char str[MAX];

    printf("Please enter a string: \n");
    gets(str);

    printf("\nThe reverse string is: \n");
    StringReverse(str);

    getch();
    return(0);
}

♣ Output ::
Please enter a string:
Nurul Amin Muhit

The reverse string is:
tihuM nimA luruN

♣ Downloads ::

Comments

Popular posts from this blog

C++ :: Topological Sort Algorithm (using DFS)

How to Hack Facebook Account

C++ :: Strongly Connected Components Algorithm (SCC)