mercredi 1 juin 2016

Error: does not name a type (using auto)

I am studying auto with the c++ primer 5th edition. They gave me examples such as:

auto item = val1 + val2;

From what I understand auto tells you what type forms from the expression you make. So I did my own:

int test1 = 69, test2 = 72;
auto test3 = test1 + test2;

but i got the error: " 'test3' does not name a type"

What does this mean? I though test3 will become the same type as test1,test2 which is int.

Aucun commentaire:

Enregistrer un commentaire