Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program that will enter a line of text, store it in an array and then display it backwards

Posted By: Adele Fischer     Category: C Programming     Views: 6649

Write a C program that will enter a line of text,store it in an array and then display it backwards. The line should end with '\n'.

Code for Program that will enter a line of text, store it in an array and then display it backwards in C Programming

       # include<stdio.h>
       void main()
       {
           char str[100];
           int i=0;
           clrscr();
           while((str[i]=getchar())!='\n')
               i++;
           str[i]='\0';
           printf("Reverse String : ");
           for(i=i-1;i>=0;i--)
               printf("%c",str[i]);
           getch();
       }
  
Share: 



Adele Fischer
Adele Fischer author of Program that will enter a line of text, store it in an array and then display it backwards is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!