交换两个没有????? [英] swap of two no.?????

查看:76
本文介绍了交换两个没有?????的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i想知道如何交换2个值,即一个是整数&

其他是使用C中的指针浮动。

解决方案

im ****** @ gmail。 com 写道:




i想知道如何交换2个值,即一个是整数&

其他是使用C中的指针浮动。



相反,我一直想了解更多历史,

但是我记不起约会了。

哦,好吧。



im ****** @ gmail.com 写道:




i想要知道如何交换2个值,即一个是整数&

其他是使用C中的指针浮点数。



你想要的是错误的,无法回答。


Per你没有正确解释你的需要。你可以请

扩展你想要的东西吗?


文章< 11 ****** ****************@m73g2000cwd.googlegroups .com> ;,
im * *****@gmail.com < im ****** @ gmail.comwrote:


>我想知道如何交换2个值,即一个是整数&
其他是使用C中的指针浮动。



你能澄清一下你的意思吗?如果你的指针是我和F以
开始,那么之后你想要我指向浮点数并将F指向
指向int - 一个指针操作?或者你想要内存位置

用于保持int现在持有浮点数反之亦然?

如果是这样,有或没有I和F被更新到点到新的位置?


如果你试图在不移动内存的情况下改变指针,

那么你就会遇到指针指向的问题之后错误

类型 - 你不能使用int指针指向浮点数。


如果你试图改变内存位置,那么你有

int和float可能有不同大小的问题,所以当你

移动其中一个时,目的地可能没有足够的空间。


浮点数必须在地址上对齐

是4字节的内部倍数,但int只能被限制

这种情况​​并不少见到2个字节的倍数,所以你可以遇到对齐问题,即使

其他一切都已成功。


-

原型是其克隆的超类型。 - maplesoft


hey
i want to know that how to swap 2 values ,that is one is integer &
other is float using pointers in C.

解决方案

im******@gmail.com wrote:

hey
i want to know that how to swap 2 values ,that is one is integer &
other is float using pointers in C.

Instead, I always wanted to know more about history,
but I just cannot remember the dates.
Oh, well.



im******@gmail.com wrote:

hey
i want to know that how to swap 2 values ,that is one is integer &
other is float using pointers in C.

What you want is so wrong that it can''t be answered.

Perhaps you aren''t explaining your need correctly. Could you please
expand on what it is that you want?


In article <11**********************@m73g2000cwd.googlegroups .com>,
im******@gmail.com <im******@gmail.comwrote:

>i want to know that how to swap 2 values ,that is one is integer &
other is float using pointers in C.

Could you clarify what you mean? If your pointers are I and F to
start, then afterwards you want I to point to the float and F to
point to the int -- a pointer operation? Or you want the memory location
that used to hold the int to now hold the float and vice versa?
If so, with or without I and F being updated to point to the new locations?

If you are trying to change the pointers without moving the memory,
then you have the problem that the pointers would point to the wrong
types afterwards -- you cannot use an int pointer to point to a float.

If you are trying ot change the memory locations, then you have
the problem that int and float may be different sizes, so when you
move one of them there might not be enough room at the destination.

It is not uncommon for floats to have to be aligned on addresses that
are internally multiples of 4 bytes, but for int to only be restricted
to multiple of 2 bytes, so you can run into alignment problems even if
everything else worked out.

--
Prototypes are supertypes of their clones. -- maplesoft


这篇关于交换两个没有?????的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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