/* * Copyright (c) 2019,JGX is the most handsome man in NCEPU * All rights reserved. * * 文件名称: delect.c * 文件标识: 见README.md * 摘要: 删除指定位置的元素 * * 当前版本: 1.1 * 作者: 贾皋肖 * 完成日期: 2019年5月2日 * * 取代版本:1.0 * 原作者: 贾皋肖 * 完成日期: 2018年4月10日 */ #include #include "static_sequence.h" int list_delect(sq_list *L, int i, Elemtype *e) { int k; if(L->length == 0) { printf("没有数据,不能删除\n"); return 0; } if(i<=0||i>L->length){ printf("位置删除异常\n"); return 0; } *e =L->data[i-1]; for(k=i; klength; k++) { L->data[k-1] = L->data[k]; } printf("删除成功!\n"); L->length--; return 1; }