Assign a value in array

so I have an array
int numarray[6]={1,2,3}
and when I cout it it's 123000
how would I replace the 0's inside the array with a -1?

thank you.

1
2
3
4
5
6
7
8
9
10
// Assign -1 to the last 3 elements
for (int i = 3; i < 6; i++)
{
  numarray[i] = -1;
}
// display all elements
for (int i = 0; i < 6; i++)
{
   std::cout << numarray[i] << " ";
}
Topic archived. No new replies allowed.