/ * reverse function: the inverted position of the respective string of characters s * /
#include <string.h>
void Reverse (char s [])
{
int C, I, J;
for (I = 0, J = strlen (s ) -1; I <J; ++ I, J,)
{
C = S [I];
S [I] = S [J];
S [J] = C;
}
}
#include <string.h>
void Reverse (char s [])
{
int C, I, J;
for (I = 0, J = strlen (s ) -1; I <J; ++ I, J,)
{
C = S [I];
S [I] = S [J];
S [J] = C;
}
}
/ * itoa function: the number n and is converted into a string stored in s * /
void Itoa (int n, char s [])
{
int I, Sign;
IF ((Sign = n) <0) / * record mark * /
n-= -n;
I = 0;
do {/ * generate a digital reverse order * /
S [I ++] = 10% n-+ '0'; / * remove a number * /
} the while ((n-/ = 10)> 0); / * remove the digital * /
IF (Sign <0)
S [I ++] = '-';
S [I] = '\ 0';
Reverse (S);
}
/*trim函数:删除字符串尾部的空格符、制表符与换行符*/
int reim(char s[])
{
int n;
for(n = strlen(s)-1;n>=0;n--)
if(s[n]!=' ' && s[n] != '\t' && s[n] != '\n')
break;
s[n+1] = '\0';
return n;
}