@fiy-fish
2015-06-25T21:17:52.000000Z
字数 577
阅读 1410
C
int main()
{
char *week[7] = {"monday",
"tuesday",
"wednesday",
"thur",
"friday",
"satur",
"sunday" };
char week1[7][10] = {};
for (int i=0; i<7; ++i) {
// printf("1111%p\n", &i);
strcpy(week1[i], week[i]);
}
//将字符串中每个字母倒置
for (int i=0; i<7; ++i) {
// printf("2222%p\n", &i);
int len = (int)strlen(week1[i]);
for (int j=0; j<len/2; ++j) {
printf("%p\n", &j);
char temp = week1[i][j];
week1[i][j]= week1[i][len-1-j];
week1[i][len-1-j] = temp;
}
}
for (int i=0; i<7; ++i) {
// printf("3333%p\n", &i);
printf("%s\n", week1[i]);
}
}
char *week[7] = {"monday",
"tuesday",
"wednesday",
"thur",
"friday",
"satur",
"sunday" };