I have tried making a dynamic array in C but I wont make it work so I'm trying to use a normal array where I just delete the rest numbers that are getting printed out. I have a array:
int array[100];
this array will store 100 numbers, annd these numbers will be scanned in with a for loop. In that for loop I do have a if statement:
if(array[i] == 0)
{
break;
}
so if I scan the number 0 the for loop will break and the code will continue. When I scan normal numbers I want for example to scan 20 numbers. The array has 100 spot for numbers but I only write 1-20 and then I type 0 which makes the loop break. Then I do have a for loop for printing the array. The printf prints the whole array 1-20 and after the 20 it will start to print out the rest 80 numbers that haven't got a number assigned. So my question is how am I able to remove all these rest numbers that gets printed out after my 1-20 numbers that I ACTUALLY scanned in? I just want the scanned numbers to be shown not all the 100.