Code:
char c;
if(isspace(c){
....
}
Use the above to check if something is a space.
Firstly gather the string length.
Code:
int len(char str[200]){
int len;
for( len = 0; str[len] != '\0'; len++ );
return len;
}
So once you have the string length.
Code:
char space[200];
int j = 0;
int i = len; //index starting from end of string
for(i = len; i >= 0; i--){ //Start going across the string from the end of the string
if(isspace(c)){ //When a space is encountered
space[j] = i; //Store it into an array
j++;
}
//You now have the index locations where the spaces occurred.
//Now use another loop starting from the beginning of the spring, and putchar(' ');
//when you come to that index location
//
Not entirely sure about this though.
Note you will have to edit this for your own use in your assignment. Because you will need some kind of while loop
while((c=getchar()) != EOF){
or something for most of this to work