954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need Help With printing Backwards

I have to make a C program read ordinary text (a sequence of lines) from the program's standard input, and print it with each line reversed from left to right. It has to be no longer than 80 symbols and it should read until it gets an EOF. Im stumped now...here is what i have so far...

#include
#include
#define MAXLEN 80

int getline(char *, int);

void main() {
char a[MAXLEN];
int i;
int temp;
int n;

getline(a, MAXLEN);

for (i=0; i

Mooonky
Newbie Poster
8 posts since Dec 2004
Reputation Points: 10
Solved Threads: 0
 

loops can be traversed in either direction. Decrease your counter from the length of a string to 0 while printing.

That's all the hint you should need.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

yeah right.

anastacia
Junior Poster
142 posts since Nov 2004
Reputation Points: 11
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You