功能与头文件 [英] Function & header files

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

问题描述

如何将程序转换为函数/宏并将其放入标题

文件?有什么快捷方法吗?

谢谢。

how to convert a program to a function/macro and put it in a header
file? is there any shortcut method for this?
thanks.

推荐答案

Umesh说:
Umesh said:

如何将程序转换为函数/宏并将其放入标题

文件?
how to convert a program to a function/macro and put it in a header
file?



不要尝试。相反,找出如何使用图书馆。


-

Richard Heathfield

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

电子邮件:rjh在上述域名, - www。

Don''t even try. Instead, find out how to use libraries.

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


6月12日,14:05,Richard Heathfield< r ... @ see.sig.invalidwrote:
On 12 Jun, 14:05, Richard Heathfield <r...@see.sig.invalidwrote:

Umesh说:
Umesh said:

如何转换a程序到一个函数/宏并把它放在一个标题

文件?
how to convert a program to a function/macro and put it in a header
file?



不要尝试。相反,找出如何使用库。


Don''t even try. Instead, find out how to use libraries.



现在你已经完成了。如果他接受了这个(他可能不会,因为他/ b $ b一般想要用勺子直接回答他的问题),他现在要求b $ b。如何使用图书馆?我们将有一堆偏离主题

回复...

Now you''ve done it. If he picks up on this (he may not, as he
generally wants to be spoonfed a direct answer to his question), he''ll
now ask "how to use libraries?" and we''ll have a heap of "off-topic"
responses...


如何转换一般来说宏的功能?例如


void factorial(int n)

{

long int x = 1;

for(int i = 1; i< = n; i ++)

x * = i;

printf(" Factorial of%d =%ld \ n", n,x);

}

How can I convert a function to a macro in general? e.g.

void factorial(int n)
{
long int x=1;
for (int i=1;i<=n;i++)
x*=i;
printf("Factorial of %d = %ld\n",n,x);
}


这篇关于功能与头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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