评估功能的顺序? [英] Order of evaluting functions ?

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

问题描述

大家好,我很抱歉我的英语不好(这不是我的母语)。

我把C中的函数的评估顺序混淆为()

功能?例如:

i有3个函数:a()b()和c()

我会写出类似的东西:

for(; a()&& b()|| c();)

评估函数的顺序是什么?

if a()和b()都是真的,c()是否会被评估?


是否取决于我使用的编译器?

你可以推荐一下我应该使用哪个C编译器,因为我开始学习C和我想要专家的b $ b。

谢谢,希望你能理解我写的:(!

解决方案



" tienlx"< ti **** *@gmail.com>在留言中写道

news:11 ********************** @ g44g2000cwa.googlegr psps.com。 ..

大家好,我很抱歉我的英语不好(这不是我的母语)。
我混淆了C函数的评估顺序()
功能?例如:
我有3个功能:a() b()和c()
我会写出类似的东西:
for(; a()&& b()|| C(); )

评估函数的顺序是什么?


评估首先''a()''。如果其值为true,则评估
''b()''。如果''b()''也为真,则评估
''c()''。这与函数没有任何关系,而是与逻辑运算符一起使用

&&和||。

如果a()和b()都为真,c()是否会被评估?


不是。

是否取决于我使用的编译器?


NO。这是一种语言规则。

你能推荐我应该使用哪个C编译器,因为我开始学习C



这取决于几个因素,例如你使用哪个平台
,你的口味,是否愿意花钱,

或者想要免费等等。


-Mike


" tienlx" < TI ***** @ gmail.com>在消息中写道

news:11 ********************** @ g44g2000cwa.googlegr oups.com ...

大家好,我很抱歉我的英语不好(这不是我的母语
语言)。我混淆了C函数在()
函数中的评估顺序?例如:
我有3个函数:a()b()和c()
我会写出类似的东西:
for(; a()&& b ()|| c();)

评估函数的顺序是什么?
如果a()和b()都为真,则将评估c()或不是吗?
是否取决于我使用的编译器?
你可以推荐我应该使用哪个C编译器,因为我开始学习C而我想要专家吧。

谢谢,希望你能理解我写的内容:(!




是的。请不要那样做只是不要。没关系是什么顺序或者你为什么这么做。这只是糟糕的编程,我希望你停下来。


如果这是作业,那么这只是一个糟糕的家庭作业问题;拿F / /
..如果是面试问题 - 请不要鼓励他们/>
在那里工作。


只需说,不!


-

Mabden


Mabden写道:

" tienlx" < TI ***** @ gmail.com>在消息中写道
新闻:11 ********************** @ g44g2000cwa.googlegr oups.com ...


大家好,我很抱歉我的英语不好(这不是我的母语)。
我很困惑C中的函数的评估顺序为()
函数?例如:
我有3个函数:a()b()和c()
我会写出类似的东西:
for(; a()&& b ()|| c();)

评估函数的顺序是什么?
如果a()和b()都为真,则将评估c()或不是吗?
是否取决于我使用的编译器?
你可以推荐我应该使用哪个C编译器,因为我开始学习C而我想要专家吧。

谢谢,希望你能理解我写的内容:(!



是的。请不要那样做。只是不要什么顺序无关紧要。
为什么要这么做。这只是糟糕的编程,我希望你停下来。

如果这是作业,那么这只是一个糟糕的家庭作业问题;拿着F
。如果是面试问题 - 请不要鼓励他们在那里工作。

只是说, ;不!




为什么?


这将更加精简如果你解释了为什么这么说的话。我们

只是为了假设你是天才?

-

Nick Keighley


Hi all, i''m sorry about my poor English ( it isn''t my native language).
I confused the order which the function in C be evaluted in for()
function ? Ex:
i have 3 functions : a() b() and c()
and i''ll write something like that:
for ( ;a() && b() || c(); )

what is the order which functions is evaluted ?
if both a() and b() was true , is c() will be evaluted or not ?

is it depend on which compiler i use ?
can u recommend me which C compiler i should use, because i''m begining
to learn C and i want to expert it.
Thanks , and hope u can understand what i wrote :( !

解决方案


"tienlx" <ti*****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...

Hi all, i''m sorry about my poor English ( it isn''t my native language).
I confused the order which the function in C be evaluted in for()
function ? Ex:
i have 3 functions : a() b() and c()
and i''ll write something like that:
for ( ;a() && b() || c(); )

what is the order which functions is evaluted ?
First ''a()'' is evaluated. If its value is true,
''b()'' is evaluated. If ''b()'' is also true, then
''c()'' is evaluated. This has nothing to do directly
with the functions, but with the logical operators
&& and ||.
if both a() and b() was true , is c() will be evaluted or not ?
Not.

is it depend on which compiler i use ?
NO. It''s a language rule.
can u recommend me which C compiler i should use, because i''m begining
to learn C



That depends on several factors, e.g. which platform you
use, your tastes, whether you''re willing to spend money,
or want it for free, etc.

-Mike


"tienlx" <ti*****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...

Hi all, i''m sorry about my poor English ( it isn''t my native language). I confused the order which the function in C be evaluted in for()
function ? Ex:
i have 3 functions : a() b() and c()
and i''ll write something like that:
for ( ;a() && b() || c(); )

what is the order which functions is evaluted ?
if both a() and b() was true , is c() will be evaluted or not ?

is it depend on which compiler i use ?
can u recommend me which C compiler i should use, because i''m begining
to learn C and i want to expert it.

Thanks , and hope u can understand what i wrote :( !



Yeah. Please don''t do that. Just don''t. It doesn''t matter what order or
why you are doing it. It''s just bad programming and I want you to stop.

If this is homework, then it is just a bad homework question; take the F
.. If it is an interview question - please don''t encourage them by
working there.

Just say, "No!"

--
Mabden


Mabden wrote:

"tienlx" <ti*****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...


Hi all, i''m sorry about my poor English ( it isn''t my native
language).
I confused the order which the function in C be evaluted in for()
function ? Ex:
i have 3 functions : a() b() and c()
and i''ll write something like that:
for ( ;a() && b() || c(); )

what is the order which functions is evaluted ?
if both a() and b() was true , is c() will be evaluted or not ?

is it depend on which compiler i use ?
can u recommend me which C compiler i should use, because i''m begining
to learn C and i want to expert it.

Thanks , and hope u can understand what i wrote :( !



Yeah. Please don''t do that. Just don''t. It doesn''t matter what order or
why you are doing it. It''s just bad programming and I want you to stop.

If this is homework, then it is just a bad homework question; take the F
. If it is an interview question - please don''t encourage them by
working there.

Just say, "No!"



why?

It would be more constructive if you explained why you say this. Are we
just to assume you''re a genius?
--
Nick Keighley


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

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