没有分号的程序 [英] Programs without semicolon

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

问题描述

我不是C专家,但我已经多次在

新闻组中讨论过这个话题。编写这样的程序有什么用呢?

为什么他们认为这么有趣?


谢谢

I''m not a C expert, but I''ve seen this topic discussed in the
newsgroup several times. What''s the deal with writing such programs?
Why are they considered so interesting?

Thanks

推荐答案

子网< su **** @ katamail.com>潦草地写道:
subnet <su****@katamail.com> scribbled the following:
我不是C专家,但我已经多次在
新闻组中讨论过这个话题。编写这样的程序有什么用呢?
为什么它们被认为是如此有趣?
I''m not a C expert, but I''ve seen this topic discussed in the
newsgroup several times. What''s the deal with writing such programs?
Why are they considered so interesting?




打败我。也许有些教授正在分发这样的作业,比如

他们已经过时了,我当然希望他们这样做。


-

/ - Joona Palaste(pa*****@cc.helsinki.fi)-------------芬兰-------- \

\ - http://www.helsinki.fi/~ palaste ---------------------规则! -------- /

"''可以很容易地证明'''的意思''我看过一次这样的证明(我没有这样做)
明白)我不能再记得了''。"

- 数学老师



Beats me. Maybe some professor is handing out such assignments like
they''re going out of fashion, which I certainly hope they are.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"''It can be easily shown that'' means ''I saw a proof of this once (which I didn''t
understand) which I can no longer remember''."
- A maths teacher


2004年5月11日星期二,subnet写道:
On Tue, 11 May 2004, subnet wrote:
我不是C专家,但我已经多次在
新闻组中讨论过这个话题。编写这样的程序有什么用呢?
为什么它们被认为是如此有趣?
I''m not a C expert, but I''ve seen this topic discussed in the
newsgroup several times. What''s the deal with writing such programs?
Why are they considered so interesting?




如果没有创意,很难做到。这个想法是你真的需要知道语言并且有一点创造力才能写出这样的程序。


另一个想法是,如果你能编写这样的程序,你1)知道一个关于语言的b $ b很多,2)你可以回想起相应的信息。

例如,拥有计算机科学学位的每个人都学会了

递归。如果我提出要求递归来解决问题的挑战,那么每个人都能够弄明白,即使他们都已经接受了递归培训。接受培训是一回事。有效地使用

是雇主真正想要的。


事情的真相是很多人都擅长使用

搜索引擎或记忆人们喜欢在

采访中使用的问题。


这些问题的另一个方面是,一旦我知道了什么答案是

我可以通过问他们同样的问题并观看他们来给我的朋友留下深刻的印象

很难找到答案。


编写一个没有分号的程序的具体挑战来自每个人都被教导的事实:


int main(void)

{

返回0;

}


是一个最小程序。你从这开始并从这里构建。如果这个

真的是最简单的程序,并且里面已经有一个分号,

你如何摆脱分号?


int main(无效)

{

返回0

}


这将不编译。你实际上必须使代码更复杂,以便

能够删除分号。


-

发送电子邮件发送至:darrell at cs dot toronto dot edu

不要发送电子邮件至 vi ************ @ whitehouse.gov


In< Pi ******* ************************@drj.pf> da*****@NOMORESPAMcs.utoronto.ca.com (Darrell Grainger)写道:
In <Pi*******************************@drj.pf> da*****@NOMORESPAMcs.utoronto.ca.com (Darrell Grainger) writes:
2004年5月11日星期二,子网写道:
On Tue, 11 May 2004, subnet wrote:
我不是C专家,但我看过这个话题在
新闻组多次。编写这些程序有什么用呢?
为什么它们被认为如此有趣?
I''m not a C expert, but I''ve seen this topic discussed in the
newsgroup several times. What''s the deal with writing such programs?
Why are they considered so interesting?



没有创意就很难做到。这个想法是你真的必须知道语言并且有一点创造力才能写出这样的程序。



It is hard to do without getting creative. The idea is that you really
have to know the language and have a bit of creativity to be able to write
such a program.




并不是的。你从一开始就知道你的主函数不能包含

任何语句或声明,除了它的两个参数之外。

你可以做的没什么用argc的声明,所以你的

唯一剩下的希望就是argv。经过这个微不足道的分析,对于熟悉C99的人来说,解决方案很明显。


C89的推理有点复杂,但仍然没什么大不了的:

唯一不需要终止分号的语句是

空块语句。所以你可以在一个if或while语句的

控制表达式中进行函数调用,条件是

执行一个空块语句。 while语句甚至允许

编程循环。


Dan

-

Dan Pop

DESY Zeuthen,RZ集团

电子邮件: Da ***** @ ifh。 de


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

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