C语言数据结构删除操作

#include stdio.hvoid main() {int LA[] = {1,3,5,7,8};int k = 3, n = 5;int i, j;printf(The original array elements are :\\n);

编程学习网为您整理以下代码实例,主要实现:C语言数据结构删除操作,希望可以帮到各位朋友。

#include <stdio.h>

voID main() {
   int LA[] = {1,3,5,7,8};
   int k = 3, n = 5;
   int i, j;

   printf("The original array elements are :\n");

   for(i = 0; i<n; i++) {
      printf("LA[%d] = %d \n", i, LA[i]);
   }

   j = k;

   while( j < n) {
      LA[j-1] = LA[j];
      j = j + 1;
   }

   n = n -1;

   printf("The array elements after deletion :\n");

   for(i = 0; i<n; i++) {
      printf("LA[%d] = %d \n", i, LA[i]);
   }
}

本文标题为:C语言数据结构删除操作

基础教程推荐