[ create a new paste ] login | about

Link: http://codepad.org/xWtLNqgR    [ raw code | output | fork ]

C++, pasted on May 26:
#include <iostream>
#include <typeinfo>
using namespace std;

struct punto3D {
   int x,y,z;
};

union Union {
  int x;
  float z;
  char a;
};

class Clase {
  public:
   Clase() {}
};

typedef int Entero;

int main() {
   int x;
   float y;
   int z[10];
   punto3D punto3d;
   Union uni;
   Clase clase;
   void *pv;
   
   cout << "variable int: " << typeid(x).name() << endl;
   cout << "variable float: " << typeid(y).name() << endl;
   cout << "array de 10 int:" << typeid(z).name() << endl;
   cout << "estructura global: " << typeid(punto3d).name() 
        << endl;
   cout << "unión global: " << typeid(uni).name() << endl;
   cout << "clase global: " << typeid(clase).name() 
        << endl;
   cout << "puntero void: " << typeid(pv).name() << endl;
   cout << "typodef Entero: " << typeid(Entero).name() 
        << endl;
   if(typeid(Entero) == typeid(int)) 
      cout << "int y Entero son el mismo tipo" << endl;
   
   return 0;
}


Output:
1
2
3
4
5
6
7
8
9
variable int: i
variable float: f
array de 10 int:A10_i
estructura global: 7punto3D
unión global: 5Union
clase global: 5Clase
puntero void: Pv
typodef Entero: i
int y Entero son el mismo tipo


Create a new paste based on this one


Comments: