Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

why cant i use strrev if i can't what other way is there to reverse a function

0 votes
asked May 14, 2020 by 1NAVEENKJOSEPH (120 points)

1 Answer

0 votes
answered May 15, 2020 by garla sai roshan (140 points)
/*
reversing a string without using built in fn
*/
#include <stdio.h>

int main()
{
    char a[10],b[10];
    int i,j;
    printf("enter a string");
    gets(a);
    for(i=0;a[i]!='\0';i++)
    {
    }
    i--;
    for(j=0;i>=0;i--,j++)
    {
        b[j]=a[i];
    }
    b[j]='\0';
    puts(b);
    return 0;
}
commented Jul 16, 2021 by [20EE032] Pranav Kumar Singh (100 points)
please can you try using strrev function as when i am using it shows error every time while my code is correct also
commented Jan 1, 2023 by 1D-king (100 points)
Same here.
DID you find solution?
commented Jun 27, 2025 by Jerry Jeremiah (2,040 points)
strrev was only available in Microsoft toolchain and does not exist in gcc of clang.  If you are using C++ you can reverse string with std::reverse.  If you are using C you need to write your own.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...