I tried to use C array to write about the code below.
When I entered=>I am a boy.
The desired output is=>boy a am I.
Here is my code below and it does not work.
I have found the bugs for 2 days and I still could not find the problem
int i,j,k,m,start,temp_end,len;
char str[30];
gets(str);
len=strlen(str);
temp_end=len-1;
for(k=len;k>0;k--)
{
    if(str[k]==" ")
        start=k;
    for(j=start+1;j<temp_end;j++)
    {
        printf("%c",str[j]);
    }
    printf(" ");
    temp_end=k;
}
for(m=0;m<temp_end;m++)
{
    printf("%2c.",str[m]);
}
 
     
     
    