获取函数的地址?? [英] get the address of a function??

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

问题描述

以下程序是否打印了该功能的地址?


void hello()

{printf(" hello \ n");

}


void main()

{

printf(" hello function =% d \ n",你好);

}


请指教。谢谢....

解决方案

John说:


Is以下程序打印函数的地址?

void hello()

{printf(" hello \ n);

}


void main()

{

printf(" hello function =%d \ n" ;,你好);

}



程序的行为至少有三种方式未定义。所以 - 也许

它会做你想要的,也许它不会。也许它会做你想要的/ b / b它不会告诉你的其他东西。没办法告诉。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)


Richard Heathfield写道:
< blockquote class =post_quotes>
John说:


>>以下程序是否打印了该函数的地址? br />
void hello()
{printf(" hello \ n");
}

void main()
{
printf(" hello function =%d \ n",hello);
}




程序的行为至少在三个方面是不确定的。所以 - 也许

它会做你想要的,也许它不会。也许它会做你想要的/ b / b它不会告诉你的其他东西。没办法告诉。



有没有找到这三种方式的奖品?


-

Ian Collins。


文章< 4q ************ @ individual.net>,

Ian Collins< ia ****** @ hotmail.comwrote:


>>> void hello()
{printf(" hello \\\
");
}



{
printf(" hello function =%d \ n",hello);
}


>程序的行为至少在三个方面是不确定的。所以 - 也许是


是否有奖励发现这三种方式?



否< stdio.h> ;, main()声明中的两个错误,将

指针传递给printf() %d格式。尽管如此,它还是可以工作。


- 理查德

-

应考虑在一些字母表中需要多达32个字符

- 1963年的X3.4。


Is the following program print the address of the function?

void hello()
{ printf("hello\n");
}

void main()
{
printf("hello function=%d\n", hello);
}

please advice. thanks....

解决方案

John said:

Is the following program print the address of the function?

void hello()
{ printf("hello\n");
}

void main()
{
printf("hello function=%d\n", hello);
}

The behaviour of the program is undefined in at least three ways. So - maybe
it will do what you want, and maybe it won''t. Maybe it will do what you
want /and/ something else that it doesn''t tell you about. No way to tell.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


Richard Heathfield wrote:

John said:

>>Is the following program print the address of the function?

void hello()
{ printf("hello\n");
}

void main()
{
printf("hello function=%d\n", hello);
}



The behaviour of the program is undefined in at least three ways. So - maybe
it will do what you want, and maybe it won''t. Maybe it will do what you
want /and/ something else that it doesn''t tell you about. No way to tell.

Is there a prize for spotting the three ways?

--
Ian Collins.


In article <4q************@individual.net>,
Ian Collins <ia******@hotmail.comwrote:

>>>void hello()
{ printf("hello\n");
}

void main()
{
printf("hello function=%d\n", hello);
}

>The behaviour of the program is undefined in at least three ways. So - maybe

Is there a prize for spotting the three ways?

No <stdio.h>, two errors in the declaration of main(), passing a
pointer to printf() with a %d format. And despite all that, it will
probably work.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.


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

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