Deleting duplicates in the array

前端 未结 2 1789
借酒劲吻你
借酒劲吻你 2021-01-25 09:16

I made a program to delete duplicates in an array but the program\'s if condition always remain true. I understood what the problem was,changed arr[i] to arr[count] and allocate

2条回答
  •  长情又很酷
    2021-01-25 09:26

    You never initialized arr. Currently it's just a pointer, it has no actual bound on it, so you could be overwriting something else.

    Also, you're never incrementing scanf("%d",&arr[i]); I think you want that to read scanf("%d",&arr[counter]);

提交回复
热议问题