第1个回答 2018-06-25
#include"stdio.h"
int del(int *arr, int n, int s, int e){
int* p = arr;
int i;
for (i = 0 ; i < n; i++) {
if (arr[i] >= s && arr[i] <= e) {
}
else {
*p = arr[i];
p++;
}
}
return (p-arr);
}
void pt(int* arr, int n) {
int i;
for (i = 0; i < n; i++) {
printf("%d ", arr[i]);
}
printf("\n");
}
int main(){
int arr[] = {1,2,3,4,5,6,7,8,9};
pt(arr, 9);
printf("After Delete\n");
pt(arr, del(arr, 9, 2, 6));
return 0;
}本回答被网友采纳