type of variable cpp code example
Example 1: print data type of a variable in c++
int x = 5;
typeid(x).name();
//output: i
// i stands for int
Example 2: variabvles in c++
#include <iostream>
using namespace std
int main{
int x = 3;
float g = 4.0;
long h = 1234567;
double j = 1237886.099;
cout<<x<<endl;
cout<<h<<endl;
cout<<g<<endl;
cout<<j<<endl;
}
Example 3: define type c++
typedef unsigned int u_int; //giving 'unsigned int' a name of u_int