Sharp Tutorial
string reverse program

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

Introduction

  • C Home
  • How To Install Software
  • First Program in C
  • Syntax and Rules
  • Data Types in C Language
  • Operators in C Language

C Programming

  • If - Else
  • Switch - Break
  • while loop
  • do while loop
  • for loop
  • Array in C
  • Multidimentional Array
  • String in C
  • Functions in C

C Advanced

  • Pointers
  • Structure
  • Sorting
  • Searching
  • File Handling
  • Stack

Important C Programs

  • Telephone bill
  • Factorial
  • Fibonacci series
  • Palindrome program
  • Armstrong No.
  • Prime No.
  • Pattern Programs
  • Maximum number from Array
  • Matrix addition& Multiplication
  • String reverse program
  • Student database
  • All Programs in C [must visit]

String reverse program in c

#include<stdio.h>
#include<conio.h>
void main()
{
char str[80],str2[80];
int len=0,i=0;
printf("enter the string");
gets(str);
while(str[len]!=NULL)//loop to find the length of the string
{
len++;
}
len=len-1; // get the last index of the string (length-1)
while(len>=0) // loop to store reverse string in other array
{
str2[i]=str[len];
len--;
i++;
}
str2[i]=NULL; // store null at the end of new string
printf("the reverse string is\n");
puts(str2);
}

   input: Sharp Tutorial    output: lairotuT prahS

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial