功能顺序。 [英] Function order.
问题描述
我可以问小组如下:(再次,唉,来自K& R)
这是功能的一部分:
while((array1 [i ++] = array2 [k ++])!=''\ 0''); / *等等* /
这是评估此订单的顺序吗?
- > array2 [k]被赋值给array1 [i] .... ????原因是它在括号内是
???
- > array1 [i]被测试为不等于''\ 0''
- >如果TRUE array1 [i]递增到array1 [i + 1]
- >如果TRUE array2 [k]递增到array2 [k + 1]
- >如果FALSE退出循环并且k和i都没有被加入。
感谢您的放纵....还要感谢大家这样做
所以令人愉快。
May I ask the group the following: (Again, alas , from K&R)
This is part of a function:
while ( ( array1[i++] = array2 [k++]) != ''\0'' ); /* etc etc */
Is this the order that this is evaluated?
-> array2[k] is assigned to array1[i] ....???? the reason being it is
within parenthesis ???
-> array1[i] is tested for non-equality to ''\0''
-> if TRUE array1[i] is incremented to array1[i+1]
-> if TRUE array2[k] is incremented to to array2[k+1]
-> if FALSE exit loop and neither k nor i is incrmented.
Thank you for your indulgence....and also thank you all for making this
so pleasurable.
推荐答案
mdh写道:
我可以问小组如下:(再次,唉,来自K& R)
这是函数的一部分:
while((array1 [i ++] = array2 [k ++])!=''\'0' '); / *等等* /
这是评估此订单的顺序吗?
- > array2 [k]被赋值给array1 [i] .... ????原因是它在括号内是
???
正确。
i和k都增加了。
表达式可以写成
do
{
array1 [i] = array2 [k ];
++ i;
++ k;
} while(array1 [i-1]!=''\ 0 '')
- > array1 [i]被测试为不等于''\ 0''
- >如果TRUE array1 [i]递增到array1 [i + 1]
否,我在副本中递增。
- >如果TRUE array2 [k]递增到array2 [k + 1]
否,k在副本中递增。
- >如果FALSE退出循环并且k和i都没有被加入。
May I ask the group the following: (Again, alas , from K&R)
This is part of a function:
while ( ( array1[i++] = array2 [k++]) != ''\0'' ); /* etc etc */
Is this the order that this is evaluated?
-> array2[k] is assigned to array1[i] ....???? the reason being it is
within parenthesis ???
Correct.
Also both i and k are incremented.
The expression could be written as
do
{
array1[i] = array2[k];
++i;
++k;
} while( array1[i-1] != ''\0'' )
-> array1[i] is tested for non-equality to ''\0''
-> if TRUE array1[i] is incremented to array1[i+1]
No, i is incremented in the copy.
-> if TRUE array2[k] is incremented to to array2[k+1]
No, k is incremented in the copy.
-> if FALSE exit loop and neither k nor i is incrmented.
不,我和k将会增加。
-
Ian Collins。
No, i and k will have been incremented.
--
Ian Collins.
Ian Collins写道:
Ian Collins wrote:
- > ; array1 [i]被测试不等于''\ 0''
-> array1[i] is tested for non-equality to ''\0''
Ian,
am I正确的是,array1 NOT array2被测试不平等
''\ 0''?
谢谢。
Ian,
am I correct in that array1 NOT array2 is tested for inequality to
''\0''?
Thanks.
mdh写道:
Ian Collins写道:
Ian Collins wrote:
- > array1 [i]测试不等于''\ 0''
-> array1[i] is tested for non-equality to ''\0''
Ian,
我正确的是,array1 NOT array2已经过测试是否不平等
''\ 0''?
Ian,
am I correct in that array1 NOT array2 is tested for inequality to
''\0''?
这是经过测试的分配操作的结果。
-
Ian Collins。
It''s the result of the assignment operation that is tested.
--
Ian Collins.
这篇关于功能顺序。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!