int revstr(char str[]){ int n = strlen(str);char strnew[1024];int i = 0;int j = 0;for(i = n-1;i >= 0;i--){ strnew[j] = str[i];j++;} for(i = 0;i < j;i++){ str[i]=strnew[i];} return 0;} int main(){ char str[256] = "hello world!";re...
scanf("%d",&n);printf("请输入数组元素:\n");for(i=0;i<n;i++)scanf("%d",array+i);printf("数组原元素的排序为:\n");for(i=0;i<n;i++)printf("%d ",array[i]);printf("\n");antitone(array,n);printf("数组反序后元素的排序为:\n");for(i=0;i<n;i++)print...
void main(){ int c[5],j;printf("请输入数组:");for(j=0;j<5;j++)scanf("%d",&c[j]);fanxu(c, j);} void fanxu(int c[], int j){ int t;for(j=0;j<5/2;j++){t=c[j];c[j]=c[4-j];c[4-j]=t;} printf("反序数组为:\n");for(j=0;j<5;j++)printf...
include<string.h> void main(){ int i,num[10],max,min;puts("输入:");scanf("%d",&num[0]);max=min=num[0];for(i=1; i<10; ++i){ scanf("%d",&num[i]);max=max<num[i]?num[i]:max;min=min>num[i]?num[i]:min;} for(i=0; i<10; ++i)printf("%-4d",num[...
include <stdio.h> int main(void){ int arr[10];int i;for(i=0;i<10;i++)scanf("%d",&a[i]);for(i=9;i>=0;i--)printf("%d ",a[i]);printf("\n");}
输出为什么不是“321”而是“121”,我目的是把数组的值反序的,小白刚学c求大佬指点。int my_strlen(char* arr){int count = 0;while (*arr != '\0'){count++;arr++;}return count;}void exc(char* arr){int len = my_strlen(arr);if (*arr != '\0'){int tmp = *arr;exc(arr + 1);*...