编程语言c [英] Programming language c

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

问题描述

有人说for()循环中的初始化语句不一定要放在for()语句中。你能澄清一下吗。

Somebody said that the initialization statement in for() loop is not necessarily to be placed in the for() statement. Can you please clarify this.

推荐答案

你不必,不,不需要:

You don't have to, no:
for (i = 0; i < 10; i++) {...}

可以写成:

Can be written as:

i = 0;
for (; i < 10; i++) {...}

甚至:

Or even:

i = 0;
for (;;) 
   {
   ...
   if (++i >= 10) break;
   }

但第一种形式通常更清晰。

But the first form is normally clearer.


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

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