返回值的地址 [英] address of return value

查看:51
本文介绍了返回值的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如何在功能中获取返回值的地址?


ex。

int function(int argument)

{

int * arg_address;

int * rtn_address;


arg_address =& argument;

rtn_address = ??;

Hi,

How can I get the address of return value in function?

ex.

int function(int argument)
{
int *arg_address;
int *rtn_address;

arg_address = &argument;
rtn_address = ??;

推荐答案

也许,你可以这样做:


int ss(int i)

{

int * k =& i;

int * j =& i;

return(int)j; //这是演员,因为j是一种类型

int *

}

may be,you can do as following:

int ss(int i)
{
int *k = &i;
int *j = &i;
return (int)j; //this is a cast,becase j is a type of
int*
}


也许,你可以如下:

int ss(int i)

{

int * k =& i;

int * j =& i;

return(int)j; //这是一个演员;


}

maybe,you can as following:
int ss(int i)
{
int *k = &i;
int *j = &i;
return (int)j; //this is a cast;

}


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


如何在函数中获取返回值的地址?
Hi,

How can I get the address of return value in function?




返回值甚至不一定具有

地址。对于足够小的类型,您的编译器可以选择将返回值放在寄存器中。


Alan



It is not necessarily the case that the return value even has an
address. For sufficiently small types your compiler may choose to place
the return value in a register.

Alan


这篇关于返回值的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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