top of page
Wave
Cactus%20Plant_edited.jpg

STRING REVERSE ​

#include<stdio.h>
void strrev1(char *a)
{
    char t;
    int i,j;
    i=0;
    while(a[i]!='\0')
        i++;
    i=i-1;
    j=0;
    while(i>=j)
    {
        t=a[i];
        a[i]=a[j];
        a[j]=t;
        i--;
        j++;
    } 
}
int main()
{
    char a[100];
    int i=0;
    printf("Enter the string: ");
    gets(a);
    strrev1(a);
    printf("\nAfter reversing the string become: ");
    while(a[i]!='\0')
    {
        printf("%c",a[i]);
        i++;
    }
    return 1;
}

Subscribe Form

Thanks for submitting!

  • Facebook
  • YouTube
  • Instagram
  • Twitter

©2020 by Abhisek Midya ( A18 )

bottom of page