将浮动文字指定为void * [英] assigning floating literal to void*

查看:60
本文介绍了将浮动文字指定为void *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有以下内容:

void * x;

const char str [] =" abcdefghijklmn" ;;


我可以分配x = 0x12345678;

我可以分配x = str;


但是如何为x分配浮点文字以使内容x是这个文字浮点的IEEE754格式吗?

if I have the following:
void *x;
const char str[]="abcdefghijklmn";

I can assign x=0x12345678;
I can assign x=str;

but how can I assign a float literal to x such that the content of x is an IEEE754 format of this literal floating point?

推荐答案

所以你不希望x指向一个浮点变量,你想要的值是指针恰好与某个浮点值相同。


Zounds!我当然希望C不会让你这样做。你希望完成什么?
So you don''t want x to point at a float variable, you want the value of the pointer to coincidentally be the same as some floating-point value.

Zounds! I certainly hope C doesn''t let you do that. What do you hope to accomplish?


你可能有一个小数的播放器:)


但你不能有一个带小数的内存地址。
You may have a player with fractional number :)

But You cant have a memory address with fractional number.


@ hschew00,


我认为这会起作用。试一试......

@hschew00,

I think this''ll work. Give it a shot...

展开 | 选择 | Wrap | 行号


这篇关于将浮动文字指定为void *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆