我有一个字符数组,我想删除满足我条件的字符。示例 我有一个 char 数组 A={1,-1,0 ,1 ,-1},我想删除等于 -1 的元素。这意味着输出是 {1,0,1},我想检查数组中有多少元素。在我的例子中是 3。你能帮帮我吗?
char* delete_char(char* sourceArray, char inputChar)
{
char* out=NULL;
//Need to malloc memory. But I don't know how many size will allocate because it depends on how many element that don't equal -1
return out;
}
int sizeofArray(char* sourceArray)
{
return size;
}