为了账号安全,请及时绑定邮箱和手机立即绑定

指针习题,,,

指针习题,,,

C
慕沐4487107 2017-12-18 23:12:18
能编译不能实现效果 编写一个函数,实现将一个已知字符串的内容复制到一个新的字符串。 #include"stdio.h" #include"string.h" void main() { char a[3][100],(*p)[100],t[100];          int i; p=a+1; printf("请输入三个字符串:"); for(i=0;i<3;i++) gets(*(p+i)); p=&a[0][100]; if(strcmp(*p,*(p+1))>0) {   strcpy(t,*p);   strcpy(*p,*(p+1));   strcpy(*(p+1),t); } if(strcmp(*p,*(p+2))>0) {   strcpy(t,*p);   strcpy(*p,*(p+2));   strcpy(*(p+2),t); } if(strcmp(*(p+1),*(p+2))>0) {   strcpy(t,*(p+1));   strcpy(*(p+1),*(p+2));   strcpy(*(p+2),t); } printf("从小到大为:\n"); for(i=0;i<3;i++) puts(*(p+i)); }
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1132 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信