void method_three(){
int arr_first[10] = {1,2,3,4,5,6,7,8,9,10}; // defination number array
int *start; // defination array start index
int *end; //defination array end index
int *temp; //defination temporary
int m; // defination int arrat lengh
int *arr_index;
int c; //defination int tempporary variable
start = arr_first;
end = arr_first+9;
m = (10-1)/2;
arr_index = arr_first;
printf("[");
for(int x = 0;x<10;x++){
if(x<9){printf("%d,",*(arr_index++));}
else{printf("%d",*(arr_index++));}
}
printf("]\n");
printf("[");
temp = m+start;
for(;start<=temp;start++,end--){
c = *start;
*start = *end;
*end = c;
}
start = arr_first;
for(int x = 0;x<10;x++){
if(x<9){printf("%d,",*(start+x));}
else{printf("%d",*(start+x));}
}
printf("]\n");
}
c 语言数组指针之反向排序
最新推荐文章于 2023-07-03 18:22:36 发布