void reversestr(char* str, char* strend)
{
char tmp;
while(strend>str)
{
tmp = *strend;
*strend = *str;
*str = tmp;
str++;
strend--;
}
return;
}
void reverseSen(char *sentence)
{
char *wordstart=sentence, *wordstop=sentence;
char *pSend=sentence,*pSstart =sentence ;
int size=0;
while(*pSend != '\0'){
pSend++;
size++;
}
pSend--;
// reverese stentence
reversestr(pSstart,pSend);
while(wordstop < pSend)
{
//find the word
while((*wordstop!='\0')&&(*wordstop!=' ')) wordstop++;
wordstop--;
//reverese the word
reversestr(wordstart,wordstop);
wordstart = wordstop +2;
wordstop = wordstart;
}
}
Categories
FollowersBlog Archive
Jobs
Find more freelance jobs
|
Saturday, January 19, 2008
Subscribe to:
Post Comments (Atom)
|
Popular Posts
|
No comments:
Post a Comment