I am trying to zero out an array element and check its status so it won't be used again, however, it seems doesn't work.
int main(int argc, char const *argv[]){
char pid[10][20] = {"abc", "dec", "dsz", "dfas"};
memset(pid[1],0,sizeof(pid[1]));
for (int i=0; i<4;i++){
printf("element %d: %s\n", i, pid[i]);
}
if (pid[1] == 0){
printf("It's empty\n");
} else{
printf("Not empty\n");
}
return 0;
}
I also used memset(pid[1],NULL,sizeof(pid[1]))
and check if pid[1] == NULL
but it gives me the same result. Any help would be so much appreciated !