Reputation: 648
Im just getting garbage values. And it is wierd the debugger shows the correct values. But its printing weird stuff insted...
this frist part is fine. Essentially, It just takes me to my problem. I have what I need to print inside that h.hashtable[hashIndex] array.
ostream& operator<<(ostream& out, const hashmap& h)
{
const char *getSymbol = NULL;
for ( int hashIndex = 0; hashIndex < maxSize; hashIndex++ )
{
getSymbol = h.hashTable[hashIndex].getSymbol();
if ( getSymbol ) // Find the one I added.
{
h.hashTable->display(out);
return out << h.hashTable[hashIndex];
}
}
return out;
}
Upvotes: 0
Views: 597
Reputation: 4022
Make sure the stream is set to print in decimal
out << dec << s.m_sharePrice;
(m_sharePrice
is a non-pointer type, right?)
Upvotes: 5
Reputation: 1673
Is the values at line:
getSymbol = h.hashTable[hashIndex].getSymbol();
fine, but crap afterwards?
You could be having a case where you have a const char* to something inside an anonymous variable, which gets deleted when the line is done.
Upvotes: 1