Solution: Populate the input string with NULL as delimiter for each substring and use a character pointer to traverse to the start of each substring in the reverse and print out the substrings.

#include
int main()
{
char str[]="This is a string";
int index,length;
char *first, *last;
for(index=0;str[index]!='\0';index++)
if(str[index]==32)
str[index]='\0';
index--;
last=&str[index];
while(last>=str)
{
while(*last!='\0')
last--;
last++;
printf("%s",last);
printf(" ");
last--;
last--;
}
}

Thank you so much for helping out engineers attend interviews. I found your site very useful.
regards,

kneofyte