printf("请输入一个字符串:"); gets(ch); inverse(ch); printf("逆序存储后的字符串为:"); puts(ch);}
include <string.h> void main(){ int i, len;char temp;char buf[512] = { 0 };scanf("%s", buf);len = strlen(buf);for (i = 0; i < len/2; i++){ temp = buf[i];buf[i] = buf[len - 1 - i];buf[len - 1 - i] = temp;} printf("%s", buf);} ...
int i,j;char ch1[8],ch2[8];for(i=0;i<8;i++){ printf("请输入第%d个字符",i);scanf("%c",&ch1[i]);fflush(stdin);} for(j=0;j<8;j++){ ch2[j]=ch1[7-j];printf("%c",ch2[j]);} }
int main(){ char s1[20], s2[20];scanf("%s", s1);int l=0,i=0;while(s1[l] !='\0') l++;for(i=0;i<l;i++){ s2[l-1-i]=s1[i];} s2[l]='\0';printf("%s", s2);return 0;}