so i have a char array that can hold up to 1000 items.. but it might not be filled up completely. How can i prevent the program from printing garbage on the screen after printing the real values from the array. btw i am reading from a file, sorting by description and using a for loop to read in and display output.

file example:

item_a 255 78.25
item_b 150 45.62

void Inventory::ReadFromFile(ifstream &fin)
{
	for(int n=0; n<SIZE; n++)
	{
		fin >> description[n] >> quantity[n] >> unitcost[n];
	}
}

void Inventory::SortByDescription()
{
	BubbleSort(description, SIZE);
}

void Inventory::Output()
{
	
	for(int n=0; n<SIZE; n++)
	{
		cout << description[n] << quantity[n] << unitcost[n];
	}
}

Keep a count of how many values you actually read into the array.

When you read the file, be sure you stop when you hit the end of the file -- EOF.