EQuestionAnswers.com Computer/Electronics Questions and Answers
C, C++, VC++, COM/DCOM, DLL and more
#Login #Sign up  Facebook Twitter TGoogle+
 

Write a program to reverse the given string without using functions

Source Code

#include<stdio.h>
#include<conio.h>
int main (int argc, char *argv[])
{
  clrscr();
  char str[100];
  char t;
  int l=0;
  printf("\Enter the String:");
10    gets(str);
11    while(str[l]!='\0')
12    {
13      l++;
14    }
15    l--;
16    for(int i=0;i<=(l/2);i++)
17    {
18      t=str[i];
19      str[i]=str[l-i];
20      str[l-i]=t;
21    }
22    printf("\nThe reversed string is:");
23    puts(str);
24    getch();
25  }

Find More from our code collection
Armstrong number, binary number to a decimal number, bubble sort, decimal number to binary number, factorial of the given number factors, fibonacci numbers, HCF and LCM, matrix, mergesort, salary of the employee. palindrome, quadratic equation, star patterns, series etc. and much more...
#Return to Example Source Code