C语言中的for和if有什么区别

Python013

C语言中的for和if有什么区别,第1张

if

连接词 conj.

1.(表示条件)如果

He will come if you invite him.

如果你请他,他会来的。

2.(表示虚拟)假如,要是

If I were you, I would never do that.

如果我是你,我决不做那件事。

3.(表示让步)即使

We'll go even if it rains.

即使下雨我们也要去。

4.是否

I wonder if she is ill.

不知她是否病了。

5.(表示因果关系)每一次...的时候(总是会)

If I feel any doubt, I inquire.

我一感到有疑问就随时询问。

名词 n.

1.条件设想[C]

There are too many ifs in his offer.

他的提议中条件太多了。

for

介词 prep.

1.为,为了

They fought for national independence.

他们为民族独立而战。

This letter is for you.

这是你的信。

2.代替代表

We used boxes for chairs.

我们用箱子当椅子坐。

3.因为,由于

I am sorry for what I said to you.

我后悔不该对你讲那些话。

4.在(指定时间)

The meeting is arranged for 9 o'clock.

会议安排在九点钟。

5.(表示时间、距离等)达,计

You can see for miles from the roof.

你站在屋顶上可以看到数英里之外。

6.对于,关于在...方面

I am too old for the job.

我年纪太大,做不了这工作。

7.为得到,为赢得

He sent the waiter for a packet of cigarettes.

他让侍者去拿一盒香烟。

8.以...为代价以...交换

He sold his car for 500 dollars.

他以五百元把车卖了。

9.当作,作为

Do you take me for a millionaire?

你是不是把我当百万富翁?

10.赞成支持倾向于

Are you for the government or against it?

你是支持还是反对政府?

11.朝...方向去往,向

He left for Taipei.

他出发去台北。

12.就...而言

She is sophisticated for her age.

就年龄而言她是世故了一点。

连接词 conj.

1.因为,由于

We must start early, for it will take two hours to drive to the airport.

我们得早点动身,因为开车去机场得花两个小时。

你上面的语句中,各条件语句的包含关系没写清楚情况1:for(){

if(1)

{

if(1)

{

if(1){printf()}

}

}}IF1成立执行IF2,IF2成立执行IF3,完了循环,如果IF2不成立不执行IF3情况2:for(){

if(1)

{

if(1)

if(1){printf()}

}}IF1成立执行IF2,IF2成立执行IF3,完了循环,如果IF2不成立,执行IF3后循环情况3:for(){

if(1)

if(1)

if(1){printf()}}不管IF1,IF2成不成立,都会执行IF3