我在 liste_tmp 中有一个指针数组,其值为“123”、“456”、“123”
声明:
char *no_rlt_liste[5] , *liste_tmp[5]; int i, j, count =0;
for (i = 0 ; i < n; i++){
for ( j= 0 ; j< count; j++){
if (liste_tmp[i] == no_rlt_liste[j]){
break;
}
if (j == count){
no_rlt_liste[count] = liste_tmp[i];
printf(" ENTER\n");
count++;
}
}
}
for (i = 0 ; i < count; i++)
printf("Final result %s\n", no_rlt_liste[i]);
上面的代码没有产生结果。无法识别错误。 有帮助吗? 谢谢
最佳答案
你的 for
由于条件j< count
,循环永远不会运行, 你已经设置了 count =0
.
关于c - 删除 char 指针数组中的重复项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20280922/