so my program is supposed to use one 5 sized array to store inputted integers. If it's a duplicated integer it would not be stored into the array.
The problem here is there would be 0's in my array indefinitely since i initialized the size to 5, there would always be 5 elements regardless if all 5 is being used or not. I need to output only the unique numbers how would i do so?
One thing i noticed was that without my unsigned int position; whenever i enter a duplicate integer it would skip the index;
e.g. array[0] = 10, array[1] = 10 // duplicate, array[2] = 20 // inputted 20, this should've been stored into array[1] but it doesn't. So i had the position to only increment whenever it's not a duplicate to make sure it's not skipping over the index when a duplicate is entered.
So the problem is if say my input was 10 10 20 30 40, my outputted display would be 10 20 30 40 0 because the last index is not used since the 2nd Int 10 input was ignored and not stored into the array but the counter would still increment for the outer loop to prompt the user to enter the next #; instead i want it to be just 10 20 30 40 and not output the 0.
And was there anything i could've done or do a different approach to get my result?
Hmm yeah, except the part where you have the if statements and then assigning 7 to it? are u assigning the array size? i don't really get that part of the code.
Don't really get the code at the if statement so your checking the arrayUsed if its < than the array size? if it is increment the array size and then assigned 7 to it? what does that do?