I have a Problem like this: C++: Storing structs in a stack
My Code:
#include <stdio.h>
#include <stack>
#include <iostream>
#include <string>
using namespace std;
struct adresse{
string info;
};
int main(){
string eingabe;
stack<adresse> Stack1;
cout << "Bitte Ausdruck eingeben: " << endl;
getline( cin, eingabe);
adresse* temp;
temp = new adresse;
temp->info = eingabe[0];
Stack1.push(temp);
return 0;
}
The error is:
reference to type 'const value_type'(aka 'const adresse') could not bind to an
lvalue of type 'adresse *'Stack1.push(temp);
What is wrong?
Thanks
Tommy