1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#define MAXLINE 512
int n;
int i=0;
char line[MAXLINE];
int word=0;
int lengthText=0;
int length=0;
char line2[MAXLINE];
lengthText = strlen(line);
length = lengthText;
while(length > 0)
{
while((line[lengthText]!=' ') && (lengthText!=0))
{
lengthText--;
}
if(lengthText==0)
{
word = lengthText;
}else{
word = lengthText + 1;
}
while(word != length)
{
line2[i] = line[word];
word++;
i++;
}
line2[i] = ' ';
i++;
length = length - (word - lengthText);
lengthText--;
}
fputs(line2,stdout); |
Partager