删除一个数组中某个值
2017-05-27 20:05 小白很我 阅读(548) 评论(0) 编辑 收藏 举报#include<stdio.h>
int
tab[10]={0,1,2,3,5,5,5,7,7,9};
void
deleteMember(
int
mem){
int
i = 0;
int
j = 0;
for
(i = 0, j = 0; i < (
sizeof
(tab)/
sizeof
(
int
)); i++){
if
(tab[i] != mem){
tab[j++] = tab[i]
}
}
for
(i = 0; i < (
sizeof
(tab)/
sizeof
(
int
))-j; i++){
tab[j+i] = 0;
}
}