C program to reverse a string

C program to reverse a string

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
int i,n;
char a[30];
clrscr();
printf(“Enter any string:”);
gets(a);

n=strlen(a);
printf(“Reverse of string:”);
for(i=(n-1);i>=0;–i)
printf(“%c”,a[i]);
getch();
}

One thought on “C program to reverse a string

  1. tasos vittas

    Hello,
    Im an IT student in greece and i want some help with a programming problem.
    The problem basically has to detect the strong components of a graph using just C.
    Any help is appreciated.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.