28 lines
573 B
C
28 lines
573 B
C
#include <stdio.h>
|
|
|
|
void show_word_reversed(char *str)
|
|
{
|
|
char sign, *end, *seek = str;
|
|
while (*seek != '.' && *seek != '?' && *seek != '!') seek += 1;
|
|
end = seek;
|
|
sign = *end;
|
|
*seek-- = 0;
|
|
for (; seek > str; seek--)
|
|
if (*seek == ' ') {
|
|
*seek = 0;
|
|
printf("%s ", seek + 1);
|
|
}
|
|
printf("%s%c\n", str, sign);
|
|
for (; seek < end; seek++)
|
|
if (*seek == 0)
|
|
*seek = ' ';
|
|
*end = sign;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
char buf[] = "Let's test this program!";
|
|
show_word_reversed(buf);
|
|
return;
|
|
}
|