How to get datatype of a variable as output

like in python we have ,say, type(4)

typeof(x) is used to get the type of variable x

@asaurabh_26
share a code displaying the basic implementation of typeof()

sorry it is not typeof()
instead it is

cout << typeid(variable).name() << endl;

Code

actually typeof is used in Javascript

in c++ these methods are not useful because here you have to define the variable with it’s type (it’s compulsory) so you always know the type of variable

@asaurabh_26
what are other implications of name() ?

you can read about Typeid here https://en.cppreference.com/w/cpp/language/typeid
in detail

Thank You! It`s the best TypeID guide i have ever seen