沉静
  
  首页 >>  
我的日历
分类日志
友情链接
最新评论
搜索日志
访问计数
获取 RSS
我的 Blog:
youalwayscan 最新的 20 条日志
[心情留言]
[点滴积累]
[好文共赏]
[C/C+基础]
[Unix/Linux基础]
[WxWidgets]
[VC/MFC]
全站 Blog:
全站最新的 20 条日志

 

优先级注意

   C/C+基础2005-4-19 11:15
The structure operators . and ->, together with () for function calls and [] for subscripts, are at the top of the precedence hierarchy and thus bind very tightly. For example, given the declaration
struct {
int len;
char *str;
} *p;

then
++p->len

increments len, not p, because the implied parenthesization is ++(p->len).

In the same way, *p->str fetches whatever str points to; *p->str++ increments str after accessing whatever it points to (just like *s++); (*p->str)++ increments whatever str points to; and *p++->str increments p after accessing whatever str points to.
标签集:TAGS:
回复Comments()点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}