Why does my program crash after running this particular function?
- by Tux
Whenever I type the command to run this function in my program, it runs and then crashes saying:
"The application has requested the Runtime to terminate it in an unusal way."
Why does it do this?
Thanks in advance,
Johnny
void showInventory(player& obj) { // By Johnny :D
std::cout << "\nINVENTORY:\n";
for(int i = 0; i < 20; i++) {
std::cout << obj.getItem(i);
i++;
std::cout << "\t\t\t" << obj.getItem(i) << "\n";
i++;
}
}
std::string getItem(int i) {
return inventory[i];
}