Hi 
Slowly learning C and currently making a program that takes a string (sentence) and does these following steps:
1)Print total of characters
2)Print total of e's
3)Reverse the words
4)Reverse the words and letters
Steps 1 and 2 are done; having a little halt with 3 and 4.
Let's take "Hello everyone" as the string.
CODE:
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, totalCharacter, totalE;
char txt[301];
// Ask user to enter his/her sentence
printf("Type your sentence: ");
gets(txt);
// 1) Total characters in the sentence (spaces included)
for(totalCharacter = 0; totalCharacter < txt[totalCharacter]; totalCharacter++);
printf("Your sentence has %i characteres (including any spaces).\n\n", totalCharacter);
// 2) Total e's in the sentence
totalE = 0;
for(i = 0; i < totalCharacter; i++){
if(txt[i] == 'e')
totalE++;}
printf("There are %i 'e' in your sentence.\n\n", totalE);
// 3) Sentence with words reversed (INCOMPLETED!)
for(i = 0; i < totalCharacter; i++)
// 4) Sentence with letters AND words reversed (INCOMPLETED!)
for(i = 0; i < totalCharacter; i++)
system("PAUSE");
return 0;
}
So, step 1 gives: 14 characters
#2: 4 e's
#3: everyone hello
#4: enoyreve olleh
My question is: can I print out steps 3 and 4 without using any string functions? I'd like to use printf and 'for' loop only, if possible. 
e.g. Something like this algorithm (:
1) Set up a counter to find the string length.
2) Find the last character and print it.
3) Decrement the counter and print the next successive characters.
Thanks in advance.