So everyone knows when you try to print something in an array that doesnt belong, the screen prints out weird stuff. I made a program that takes a file, fills an array with 10 numbers, and prints only distinct numbers. So if there's a repeated number, the program replaces that number with a space. Once that's done, the program finally prints out what's left in the array which should be only distinct numbers. Anyway, here's my code.
Let's say I want to make an array of 100 slots but only have the program take in 50 numbers (because there are only 50 numbers in the file). When I do that, I get the jibberish. The program works fine when I only make a file with exactly the amount of numbers that my array can hold. It actually still works with any size but I dont want the jibberish. What must be fixed?