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 find Size of Integer
  • Swap Two Static Numbers Using C
  • C Program to Sort an Array using SELECTION SORT
  • C Program to Print Pyramid of Numbers
  • C Program to ADD two MATRICES
  • C Program to Calculate Sum of Odd Values in an Array
  • C Program to Find Sub String Position in Given String
  • Merge Sort Program in C
  • C Program to Find Largest Element in an Array
  • C Program to Implement Single Linked List Operations
  • C Program to Find Biggest among Three Numbers
  • C Program to Swap Two Numbers without using Third Variable
  • C program to Convert Number to Words
  • C Program to Find Biggest of Two Numbers using Ternary
  • FCFS CPU Scheduling Algorithm Simulation Using C
  • Privacy Policy
  • Cookie Policy
© programming9.com 2025
Back to top