Looks like you have mismatched braces. The brace at line 15 visually appears to be part of the if-else, but actually it is closing the while loop which began at line 2.
But your question regarding item_Name, this is declared as a local variable within the first while loop. When you try to refer to it at line 20, it has gone out of scope (no longer exists) because of the previous closing brace.
Two suggestions, take care to match the opening and closing braces carefully (currently they are wrong) and if necessary move the declaration of item_Name to a higher level so that it remains in scope.
char item_Name[MAX_CHAR] = {'\0'};
while (true) {
cout << "Please, enter name of item you would like "
<< "to purchase"
<< endl;
if (cin.getline (item_Name, MAX_CHAR, '\n')) {
break;
}
else
cout << "Invalid Input: please only enter strings ";
cin.clear();
cin.ignore(MAX_CHAR, '\n');
}
cin.ignore(MAX_CHAR, '\n');
while (true) {
double item_Cost = 0.0;
cout << "Please, enter the cost of item: " << item_Name
<< endl;
if (cin >> item_Cost) {
break;
}
else
cout << "Invalid Input: please only enter numbers ";
cin.clear();
cin.ignore(MAX_CHAR, '\n');
}
cin.ignore(MAX_CHAR, '\n');
the problematic variable is not printing to common output.
EDIT: going factor both of these blocks so this is the other issue, that may not be jumping out at you just by my code and explanations. Hence the reason for pointers. I could just pass the variable by value but I want to try for a pointer here.
I still think in the amended code the braces are mismatched. From the context it looks like there should be an open brace after the else at line 9, and then another closing brace to complete the while loop.
Sorry, I don't understand the rest of the question.