how to check the datatype of a variable in c++
C++
#include <typeinfo>
#include <iostream>
class someClass { };
int main(int argc, char* argv[]) {
int a;
someClass b;
std::cout<<"a is of type: "<<typeid(a).name()<<std::endl;
// Output 'a is of type int'
std::cout<<"b is of type: "<<typeid(b).name()<<std::endl;
// Output 'b is of type someClass'
return 0;
// on the online compiler it comes as 'i' for int and 'c' for char
}#include <typeinfo>
...
cout << typeid(variable).name() << endl;
Also in C++:
- Title
- array search c++
- Category
- C++
- Title
- c++ vector size
- Category
- C++
- Title
- convert decimal to binary in c++
- Category
- C++
- Title
- c++ raw string
- Category
- C++
- Title
- initialising 2d vector
- Category
- C++
- Title
- c++ convert const char* to LPCWSTR
- Category
- C++
- Title
- passing a vector to a function c++
- Category
- C++
- Title
- binary tree search
- Category
- C++
- Title
- properties of a set c++
- Category
- C++
- Title
- length of string in c++
- Category
- C++
- Title
- sort function in c++
- Category
- C++
- Title
- for c++
- Category
- C++
- Title
- how to run a c++ program in the background
- Category
- C++
- Title
- is x prime?
- Category
- C++
- Title
- declaring 2d vector in c++
- Category
- C++
- Title
- linear search in c++
- Category
- C++
- Title
- differentialble programming
- Category
- C++
- Title
- error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(s[i] != "b"){
- Category
- C++
- Title
- c++ read matttrix from text file
- Category
- C++
- Title
- how to initialize a vector in c++
- Category
- C++
- Title
- c++ vector lower_bound index
- Category
- C++
- Title
- longest common subsequence
- Category
- C++
- Title
- placement new c++
- Category
- C++
- Title
- registering a new QML type
- Category
- C++
- Title
- how to check type in c++
- Category
- C++
- Title
- convert stirng to int c++
- Category
- C++
- Title
- remove element by index from vector c++
- Category
- C++
- Title
- switch statement c++
- Category
- C++
- Title
- swapo algorit
- Category
- C++
- Title
- trovare il valore massimo in un array c++ w3
- Category
- C++
- Title
- exponenciacion binaria
- Category
- C++
- Title
- findung the mode in c++
- Category
- C++
- Title
- memset
- Category
- C++
- Title
- How to check if a triangular cycle exists in a graph
- Category
- C++
- Title
- pair c++
- Category
- C++
- Title
- passing array to function c++ pointer
- Category
- C++
- Title
- knapsack
- Category
- C++
- Title
- c++ char if
- Category
- C++
- Title
- c++ std::copy to cout
- Category
- C++
- Title
- find in set of pairs using first value cpp
- Category
- C++
- Title
- how to convert a string to a double c++
- Category
- C++
- Title
- loop through array c++
- Category
- C++
- Title
- index string c++
- Category
- C++
- Title
- c++ function to find minimum element in array
- Category
- C++
- Title
- how to switch to another branch in git
- Category
- C++
- Title
- c++ class template
- Category
- C++
- Title
- min heap priority queue c++
- Category
- C++
- Title
- variant hold type
- Category
- C++
- Title
- self in c++
- Category
- C++
- Title
- how to turn int into string c++
- Category
- C++
- Title
- c++ get type name of object
- Category
- C++
- Title
- bitset c++
- Category
- C++
- Title
- pop_back
- Category
- C++
- Title
- in c, is class uppercase or lowercase
- Category
- C++
- Title
- c++ show time elapsed
- Category
- C++
- Title
- c++ remove text file
- Category
- C++
- Title
- new class * [] c++
- Category
- C++
- Title
- How to find the kth smallest number in cinstant space
- Category
- C++
- Title
- cs1955 unity vector3
- Category
- C++
- Title
- can we compare a long long int with int in c++ using max or min functions
- Category
- C++
- Title
- char* to int in cpp
- Category
- C++
- Title
- tuple c++
- Category
- C++
- Title
- qt graphics scene map cursor position
- Category
- C++
- Title
- c++ short if
- Category
- C++
- Title
- how to check sqrt of number is integer c++
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- nth_element c++
- Category
- C++
- Title
- C++ remove element from set
- Category
- C++
- Title
- what is order in of preeendence in float, int, char, bool
- Category
- C++
- Title
- mingw32/bin/ld.exe: C:\Users\mfrom\AppData\Local\Temp\ccSKcRks.o:PizzaPi.cpp:(.text$_ZN5PizzaC2Ev[__ZN5PizzaC2Ev]+0xa): undefined reference to `vtable for Pizza' collect2.exe: error: ld returned 1 exit status
- Category
- C++
- Title
- count number of zeros in array in O(logN)
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- RLE Encoding/Compression c++
- Category
- C++
- Title
- variabili in c++
- Category
- C++
- Title
- c++ functions
- Category
- C++
- Title
- simple timer arduino blynk library error
- Category
- C++
- Title
- c++ files
- Category
- C++
- Title
- stl sort in c++
- Category
- C++
- Title
- c++ loop through array
- Category
- C++
- Title
- c++ how to skip the last element of vector
- Category
- C++
- Title
- c++ class constructor
- Category
- C++
- Title
- C++ cin cout
- Category
- C++
- Title
- Given an undirected graph, count the number of connected components.
- Category
- C++
- Title
- c++ comment
- Category
- C++
- Title
- c++ argv
- Category
- C++
- Title
- how to delete a node c++
- Category
- C++
- Title
- c++ get length of array
- Category
- C++
- Title
- how to include seld declared header file in c++
- Category
- C++
- Title
- intersection between vector c++
- Category
- C++
- Title
- initialize int c++
- Category
- C++
- Title
- set c++
- Category
- C++
- Title
- chess perft 5
- Category
- C++
- Title
- how to sort in descending order c++
- Category
- C++
- Title
- c++ append to list
- Category
- C++
- Title
- c++ base 10 to base 2
- Category
- C++
- Title
- Runtime Error: Runtime ErrorAbort signal from abort(3) (SIGABRT)
- Category
- C++
- Title
- how initilaize deffult value to c++ class
- Category
- C++
- Title
- Combination Sum
- Category
- C++
- Title
- best fit algorithm
- Category
- C++
- Title
- call by reference c++ example
- Category
- C++