【发布时间】:2021-01-31 15:47:12
【问题描述】:
C 新手。所以我看到了这行代码
system->word[system->index++] = system->next_char;
是否等同于:
system->word[system->index] = system->next_char;
index++;
后期增量的优先级是什么?是否只在该行的所有操作执行完成后将 index 的值加 1?
【问题讨论】:
-
也许您应该阅读有关序列点和未定义行为的信息。
-
有关运算符优先级的表格,请参见此链接:en.cppreference.com/w/c/language/operator_precedence
-
@user202729 OP 的第一条语句中没有隐含的未定义行为。
-
@AdrianMole:也就是说,假设
system是struct而不是union。 -
@adr 我知道,但这是 op 在阅读或编写类似代码时应该知道的。
标签: c operator-precedence