How can i find out a parameter's type?
e.g.
char no1='a';
which function can i use to find out no1 is char type?
fun(no1)
reture the no1's type
How can i find out a parameter's type?
e.g.
char no1='a';
which function can i use to find out no1 is char type?
fun(no1)
reture the no1's type
#include <iostream>
#include <string>
#include <typeinfo>
using namespace std;
template <typename T>
string typeof ( T arg )
{
return typeid ( arg ).name();
}
int main()
{
char ch = 'a';
cout<< typeof ( ch ) <<endl;
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.