由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - *d++ = *s++
相关主题
问个碰到的c语言面试题搞不清C++里的constant expression
一道题,我觉得挺难中缀表达式,这个到底要返回多少?
H1b application现在的据信都很委婉啊
看烙印如何评价同胞的问一道fb的面试题目
几道a家onsite问题讨论贴一道难题
有个SB interviewer和我说++i比i++好这道题怎么做的?
再攒人品,发道某大公司面食题Credential Evaluation (Official)
中缀转前缀表达式请教H1B材料 准备的小问题
相关话题的讨论汇总
话题: precedence话题: postfix话题: operator话题: higher
进入JobHunting版参与讨论
1 (共1页)
r**c
发帖数: 30
1
why *d is evaluate first then ++? In the precedence table it shows ++ (
postfix) is higher than dereference.
z******g
发帖数: 271
2
It's easy to confuse operator precedence with order of evaluation. Operator
precedence only decides how operators match with operands, not the order
they are evaluated.
You are correct that the precedence of postfix is higher than dereference.
But that only tells you *d++ should be *(d++) but not (*d)++. This does not
conflict with the fact that postfix is evaluated after the statement.
Hope that helps.
r**c
发帖数: 30
3
So this means it's equivalent to
*d = *s;
d++;
s++;
right?
z******g
发帖数: 271
4
Yes. That is correct.
r**c
发帖数: 30
5
Thanks! Yesterday I had a phone interview with Google.
The interviewer thought it's wrong to use *d++ = *s++ to do copy as ++ will
happen before *. Shall I find a way to tell him? (via recruiter). Will
that have any influence on his decision?
p***y
发帖数: 637
6
这代码风格不好啊。表达式有副作用,而且是容易弄错的副作用。多写一两行少很多歧
义。

will

【在 r**c 的大作中提到】
: Thanks! Yesterday I had a phone interview with Google.
: The interviewer thought it's wrong to use *d++ = *s++ to do copy as ++ will
: happen before *. Shall I find a way to tell him? (via recruiter). Will
: that have any influence on his decision?

N*D
发帖数: 3641
7
这真有人考啊?回字的四种写法?
s**x
发帖数: 7506
8
面试千万不要写这种code.
To me, this is only used in the famous string Copy:
While ( *d++=*s++);
1 (共1页)
进入JobHunting版参与讨论
相关主题
请教H1B材料 准备的小问题几道a家onsite问题讨论贴
申请H1B时有一个Foreign credentials may need to be evaluated by a recognized credentials evaluation service有个SB interviewer和我说++i比i++好
Search Engine Evaulator再攒人品,发道某大公司面食题
【工作机会】Search Engine Evaluator (限美国地区)中缀转前缀表达式
问个碰到的c语言面试题搞不清C++里的constant expression
一道题,我觉得挺难中缀表达式,这个到底要返回多少?
H1b application现在的据信都很委婉啊
看烙印如何评价同胞的问一道fb的面试题目
相关话题的讨论汇总
话题: precedence话题: postfix话题: operator话题: higher