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();
}

1 thought on “C program to reverse a string”

  1. 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.

Leave a Comment

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