0

I want just to include any type variable and also want program to find out which type I included. Please, help me if anyone know

For example If I include "C++". Then program have to find out which type "C++" is or "C++" is string type. Can I do it using template?

10th Nov 2016, 11:52 AM
shahin
shahin - avatar
1 Odpowiedź
+ 2
You does not have to create a new function. C++ have inbuilt function typeid(s).name() where s is any type of variable. use it with #include<typeinfo> In some compiler it shows (let say s is int type) i instead of writing int. In playground of this app show it as i not int. Although you can also define a function that return full name of variable. Use sizeof and it will return value of int is 16 bit and string is 64 bits. compare and than return value.
10th Nov 2016, 12:47 PM
Aditya kumar pandey
Aditya kumar pandey - avatar