c语言删除有序数组中的一个数

#include 
#include 
#define M 10
#include 
int main(int argc, const char * argv[])
{
 
    int i;
    int j;
    int t=0;
    int tmp;
    int n;
    int a[M]={};
    srand(time(NULL));
   方法一:/*  使用数组来实现
    //使用随机数向数组中添加元素
    for (i=0; ia[i+1])
      {
          tmp=a[i];
          a[i]=a[i+1];
          a[i+1]=tmp;
      }
    }
    }
    //输出排序后的结果
    for (i=0; i    //2.使用指针实现
    
    
    for (i=0; i*(a+i+1))
            {
                tmp=*(a+i);
                *(a+i)=*(a+i+1);
                 *(a+i+1)=tmp;
            }
        }
    }
    //输出排序后的结果
    for (i=0; i

你可能感兴趣的:(C语言)