删除顺序表某一元素
#include <stdio.h> #include <stdlib.h> int delX(int num[], int n, int x){ int i, j; i = 0; j = 0; for (i = 0; i < n; i++){ if (num[i] != x){ num[j] = num[i]; j++; } } return j; } print(int num[], int n){ int i; for (i = 0; i < n; i++){ printf("%d ", num[i]); } } main(){ int n; int num[] = {3, 1, 2, 3, 4, 3, 3, 5, 6}; n = delX(num, 9, 3); print(num, n); }