To check the type of a variable in C++, you can use typeid(variable).name(), for example
#include <typeinfo>
...
...
int b=9;
char c='a';
char * p=&c;
int *d;
printf("%s\n",typeid(b).name());
printf("%s\n",typeid(c).name());
printf("%s\n",typeid(p).name());
printf("%s\n",typeid(d).name());
- the typeid of variables of int type is i
- the typeid of variables of char type is c
- the typeid of pointers of type char * is Pc
- the typeid of pinters of type int * is Pi
reference: https://stackoverflow.com/questions/11310898/how-do-i-get-the-type-of-a-variable