Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
0 like 0 dislike
966 views

Goeduhub's Top Online Courses @Udemy

For Indian Students- INR 360/- || For International Students- $9.99/-

S.No.

Course Name

 Coupon

1.

Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence || Labeled as Highest Rated Course by Udemy

Apply Coupon

2.

Complete Machine Learning & Data Science with Python| ML A-Z Apply Coupon

3.

Complete Python Programming from scratch | Python Projects Apply Coupon
    More Courses

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.1k points)
edited by
 
Best answer

Reverse a String

In this program we are going to reverse a user provided string using C programming.

To learn basics of string in C programming Click Here.

Example :

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[100],revstr[100];
int i,j=0;
clrscr();

//Take input string from user
printf("\nEnter a string:");
gets(str);


//To access each element from string in reverse order
for(i=strlen(str)-1;i>=0;i--)
{
revstr[j]=str[i];
j++;
}
printf("\nReversed:\n");
puts(revstr);

getch();
}

Output :

Output of above program showing reversed string


For More GTU C Programming Lab Experiments Click Here

3.3k questions

7.1k answers

394 comments

4.6k users

Related questions

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 
...