#include #include // for typeid using namespace std; int main() { auto v1 = 7; // v1 is type int auto mygrade ='a'; // mygrade is type char auto pi = 31.4; // pi is type double auto cstring = "have a nice day"; // cstring is type pointer to const char auto ptr2char = &mygrade; // ptr2char is type pointer to char auto z = "zebra"[0]; // z is type char cout << typeid(v1).name() << endl; cout << typeid(mygrade).name() << endl; cout << typeid(pi).name() << endl; cout << typeid(cstring).name() << endl; cout << typeid(ptr2char).name() << endl; cout << typeid(z).name() << endl; typedef decltype(7) myint; myint x; cout << typeid(x).name() << endl; decltype(7) y; cout << typeid(y).name() << endl; // Somewhat practical int array[3][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}; cout << typeid(array).name() << endl; cout << typeid(array[1]).name() << endl; cout << typeid(*array).name() << endl; cout << typeid(&array).name() << endl; }