Sorry to all in previous topic - I decided to start a fresh one about
the same thing because the old one was getting a bit 'busy'.
I've 'desk-checked' and I still can't figure out why if I enter 'he' it
outputs 'ee'.
Could you give me another hint?
I've updated the program:
#include <stdio.h>
#define MAXINPUT 256
void reverse(char[], int);
main()
{
int c;
int number = 0;
char s[MAXINPUT];
int i;
for (i=0; (i<MAXINPUT-1) && ((c = getchar()) != '\n') && (c!=EOF);
i++) {
s[i] = c;
++number;
}
reverse(s, number);
for (i=0; i<=number-1; i++)
putchar(s[i]);
return 0;
}
void reverse(char s[], int num_elements)
{
int i, j;
for (i=0,j=num_elements-1; (i<=num_elements-1) && (j>=0); i++,j--)
s[i] = s[j];
}