C program to Reverse String (Manual)

#include <stdio.h>
int main()

 {
    char str[50], rev[50];
    int i, j = 0;

    printf("Enter the string : ");
    scanf("%s", str);

    for(i = 0; str[i] != '\0'; i++);

    for(i = i - 1; i >= 0; i--) 
{
        rev[j++] = str[i];
    }
    rev[j] = '\0';

    printf("Reversed: %s", rev);
}

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices