programming9
  • Flowcharts
  • Programs
      • Back
      • C Programs
      • C++ Programs
      • Java Programs
      • Python Codes
      • HTML Codes
      • Java Script Codes
      • SQL Codes
  • Tutorials
      • Back
      • Java Tutorials
      • Competitive Programming
      • Python Tutorials
      • C Programming
  • Blog
  • Login

C Program to Print Reverse of a String without strrev() function

Details
Written by: RajaSekhar
Category: C Programs
  • C Functions
  • C Program
  • function
  • strrev
  • user defined
  • built in function
#include <string.h>
#include <conio.h>
#include <stdio.h>

void main()
{
    int i,j,len=0;
    char str[50],revstr[50];
    //clrscr();
    printf("\n Enter a String to Reverse : " );
    gets(str);
    for(i=0; str[i]!='\0'; i++)
    {
        len++;
    }

    j=0;
    for(i=len-1; i>=0; i--)
    {
        revstr[j++]=str[i];
    }
    printf("\n Reverse of the Given String is: %s",revstr);
    free(str);
    getch();
}

 OUTPUT:

 Enter a String to Reverse : www.programming9.com

 Reverse of the Given String is: moc.9gnimmargorp.www
Previous article: C Program for String Concatenation without using strcat() Prev Next article: C Program for String Comparison without using Built in Function Next
  • C Program to Convert Infix to Postfix Expression using Stack
  • C Program to Find Sum of Even Integers
  • C Program for LINEAR SEARCH
  • Binary Search Program in C using Recursive and Non-Recursive Methods
  • C Program to Find Roots of a Quadratic Equation
  • C Program for Quick Sort
  • C Program to Implement STACK Operations Using Pointers
  • C Program to Find Reverse of a Number using Recursion
  • C Program for Floyd Triangle
  • C Program to CONCATENATE Two Strings using strcat()
  • C Program to Perform Arithmetic Operations Using Switch
  • C Program for Call By Reference
  • Page Replacement Programs in C
  • C Program for Sum of Digits of a Number
  • C Program to Check the Leap Year
  • Privacy Policy
  • Cookie Policy
© programming9.com 2025
Back to top