【发布时间】:2016-09-13 20:46:49
【问题描述】:
我很好奇这个函数的作用以及它为什么有用。我知道这确实将浮点数转换为整数,任何详细解释将不胜感激。
unsigned int func(float t)
{
return *(unsigned int *)&t;
}
谢谢
【问题讨论】:
-
这被称为type punning。作为附加讲座:cocoawithlove.com/2008/04/…
标签: c pointers floating-point type-conversion