Example: if the input was DOG, HOW KATS output - CATS LIKE DOGS
consider that I should use only: If-else conditions, while for loops, arrays, strings, and functions. NOT string functions, pointers and dynamic allocation of memory and structure. Spaces should be the same as in the example.
I tried to do the following, but it does not work, can you help?
void revSent(char str[]){
char temp[100];
int k;
for (i=sentenceSize ; i>0 ; i--)
for (k=0 ; k<sentenceSize ; k++)
temp[k]=str[i];
for (k=0 ; k<sentenceSize ; k++)
if (temp[k]!=' ')
for (i=k ; i>0 ; i--)
printf("%c", temp[i]);
}
source
share