Foro de elhacker.net

Programación => Programación C/C++ => Mensaje iniciado por: digimikeh en 2 Noviembre 2021, 13:26 pm



Título: Typeid de tipos básicos
Publicado por: digimikeh en 2 Noviembre 2021, 13:26 pm
buenas

Al imprimir en el terminal el nombre del tipo de unas variable me imprime solo la primera letra.

Código
  1. int m = 6;
  2. std::cout << typeid(m).name();

Imprime: i
Es eso debido al compilador? Estoy usando Linux

Saludos

MOD: Movido el código dentro de la etiqueta GeSHi


Título: Re: Typeid de tipos básicos
Publicado por: Eternal Idol en 2 Noviembre 2021, 14:06 pm
A mi con VC++ me imprime int pero:


"Returns an implementation defined null-terminated character string containing the name of the type. No guarantees are given; in particular, the returned string can be identical for several types and change between invocations of the same program. "

https://en.cppreference.com/w/cpp/types/type_info/name