1.整理这两天的思维导图
2.整理上课讲的C考试卷中的编程题
#include <stdio.h>
//分析题可知:函数功能为倒置,返回值为void
void dz(char *p,char j ,char i ){
char t;
while(j<i){
if(j<i){
t=*(p+i);
*(p+i)=*(p+j);
*(p+j)=t;
j++;
i--;
}
}
}
int main(int argc, const char *argv[])
{
char s[]="I love chain";
int i=0,j=0,k=0,t=0;
while(s[i]){
i++;
}
i-=1;
dz(s,j,i);//全部倒转
printf("%s\n",s);
i=0,j=0;
while(s[i]){
while(s[i]==' '){
i++;
}
j=i;//头下标
while(s[i]!=' '&&s[i]!=0){
i++;
}
k=i;
k-=1;//尾下标
dz(s,j,k);
}
printf("%s\n",s);
return 0;
}