I try to run reverse on string But it does not work for me.
For example i tried:-
Run to the letter Z in str
and store all the letter that comes between the letter Z
and A
on a new string str1
.
My code:
int main()
{
char str[8] = "RREADFZ";
char str1[8];
int i,k;
for(i =0; i<8; i++)
{
if(str[i] == 'Z')
{
while(str1[k] != 'A')
{
str1[k] = str[i];
i--;
k--;
}
}
}
printf("%s\n",str1);
}