vendredi 25 septembre 2015

C2040 'auto' differs in levels of 'int*' Pointers

The auto command is new for me and I am getting a compiler error on the line: (auto pd1 = scores.begin(); //the auto is required for C++11) I am getting the error and having trouble figuring out what is causing the issue.

Can someone help me?

int main() {
    BasicKlass1 m1;
    //m1.loadVector();
    //m1.buildVectorList();
    //m1.buildVectorList1();

    int *pd1;
    vector<int> scores;
    //vector<int>::iterator pd;

    auto pd1 = scores.begin(); //the auto is required for C++11
    *pd1 = 22;
    cout << *pd1 << endl;
    //++pd;
    //cout << pd << endl;

Aucun commentaire:

Enregistrer un commentaire